drm: tests: Fix invalid printf format specifiers in KUnit tests
authorDavid Gow <davidgow@google.com>
Wed, 28 Feb 2024 05:27:20 +0000 (13:27 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 28 Feb 2024 20:07:39 +0000 (13:07 -0700)
commitfc9a615200d48e076af58f4309f507e500ed900d
tree0ce5d6d0707650b9cea321ab9b1ba332ab65d570
parent689a930b93c5c20294df5da0407df361c5412eac
drm: tests: Fix invalid printf format specifiers in KUnit tests

The drm_buddy_test's alloc_contiguous test used a u64 for the page size,
which was then updated to be an 'unsigned long' to avoid 64-bit
multiplication division helpers.

However, the variable is logged by some KUNIT_ASSERT_EQ_MSG() using the
'%d' or '%llu' format specifiers, the former of which is always wrong,
and the latter is no longer correct now that ps is no longer a u64. Fix
these to all use '%lu'.

Also, drm_mm_test calls KUNIT_FAIL() with an empty string as the
message. gcc and clang warns if a printf format string is empty, so
give these some more detailed error messages, which should be more
useful anyway.

Fixes: a64056bb5a32 ("drm/tests/drm_buddy: add alloc_contiguous test")
Fixes: fca7526b7d89 ("drm/tests/drm_buddy: fix build failure on 32-bit targets")
Fixes: fc8d29e298cf ("drm: selftest: convert drm_mm selftest to KUnit")
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
drivers/gpu/drm/tests/drm_buddy_test.c
drivers/gpu/drm/tests/drm_mm_test.c