]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/sched: Fix clang build warning in kunit tests
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Fri, 22 May 2026 09:01:29 +0000 (10:01 +0100)
committerTvrtko Ursulin <tursulin@ursulin.net>
Fri, 29 May 2026 09:37:12 +0000 (10:37 +0100)
commitf412fe573b3c78fdcf351e282a3c488bb073846b
tree37d2011d0ef3de33fcd9d26b94c4f6247872ffa0
parent18178f2ac176f4b1e1c0555bed9d66b04fdf171e
drm/sched: Fix clang build warning in kunit tests

Initializing compile time constant struct or arrays from another such
variable is a gcc extension, while clang strictly requires a compile time
constant literal.

As reported by LKP:

>> drivers/gpu/drm/scheduler/tests/tests_scheduler.c:675:10: error: initializer element is not a compile-time constant
                                 drm_sched_scheduler_two_clients_attr),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:224:13: note: expanded from macro 'KUNIT_CASE_PARAM_ATTR'
                     .attr = attributes, .module_name = KBUILD_MODNAME}
                             ^~~~~~~~~~
   1 error generated.

vim +675 drivers/gpu/drm/scheduler/tests/tests_scheduler.c

   671
   672 static struct kunit_case drm_sched_scheduler_two_clients_tests[] = {
   673 KUNIT_CASE_PARAM_ATTR(drm_sched_scheduler_two_clients_test,
   674       drm_sched_scheduler_two_clients_gen_params,
 > 675       drm_sched_scheduler_two_clients_attr),
   676 {}
   677 };
   678

Fix it by using a compound literal as other tests do.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605220312.Pu7UO05u-lkp@intel.com/
Fixes: 97ef806a5314 ("drm/sched: Add some scheduling quality unit tests")
Cc: Philipp Stanner <phasta@kernel.org>
Acked-by: Philipp Stanner <phasta@kernel.org>
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
Link: https://lore.kernel.org/r/20260522090129.9385-1-tvrtko.ursulin@igalia.com
drivers/gpu/drm/scheduler/tests/tests_scheduler.c