Le 20/04/2026 à 8:28 PM, Albert Esteve a écrit :
From: Guenter Roeck <[email protected]>
The drm_test_rect_calc_hscale and drm_test_rect_calc_vscale unit tests
intentionally trigger warning backtraces by providing bad parameters to
the tested functions. What is tested is the return value, not the existence
of a warning backtrace. Suppress the backtraces to avoid clogging the
kernel log and distraction from real problems.
Tested-by: Linux Kernel Functional Testing <[email protected]>
Acked-by: Dan Carpenter <[email protected]>
Acked-by: Maíra Canal <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Alessandro Carminati <[email protected]>
Signed-off-by: Albert Esteve <[email protected]>
---
Acked-by: David Gow <[email protected]>
Some of the suggestions in the thread around __cleanup() et al. sound
good to me, too. I suspect that it should work given the
kunit_add_action() / resource system use anyway, so even if an assertion
fires, things should be cleaned up properly.
Cheers,
-- David
drivers/gpu/drm/tests/drm_rect_test.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_rect_test.c
b/drivers/gpu/drm/tests/drm_rect_test.c
index 17e1f34b76101..1dd7d819165e7 100644
--- a/drivers/gpu/drm/tests/drm_rect_test.c
+++ b/drivers/gpu/drm/tests/drm_rect_test.c
@@ -409,8 +409,15 @@ static void drm_test_rect_calc_hscale(struct kunit *test)
const struct drm_rect_scale_case *params = test->param_value;
int scaling_factor;
+ /*
+ * drm_rect_calc_hscale() generates a warning backtrace whenever bad
+ * parameters are passed to it. This affects all unit tests with an
+ * error code in expected_scaling_factor.
+ */
+ KUNIT_START_SUPPRESSED_WARNING(test);
scaling_factor = drm_rect_calc_hscale(¶ms->src, ¶ms->dst,
params->min_range,
params->max_range);
+ KUNIT_END_SUPPRESSED_WARNING(test);
KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor);
}
@@ -420,8 +427,15 @@ static void drm_test_rect_calc_vscale(struct kunit *test)
const struct drm_rect_scale_case *params = test->param_value;
int scaling_factor;
+ /*
+ * drm_rect_calc_vscale() generates a warning backtrace whenever bad
+ * parameters are passed to it. This affects all unit tests with an
+ * error code in expected_scaling_factor.
+ */
+ KUNIT_START_SUPPRESSED_WARNING(test);
scaling_factor = drm_rect_calc_vscale(¶ms->src, ¶ms->dst,
params->min_range,
params->max_range);
+ KUNIT_END_SUPPRESSED_WARNING(test);
KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor);
}