[PATCH] drm/rect: only print the stack trace in drm_calc_scale() once

Dan Carpenter dan.carpenter at linaro.org
Thu Nov 2 07:50:17 UTC 2023


The kunit test triggers this stack trace deliberately.  The
drm_rect_scale_cases[] test cases include a negative src and a negative
dst.  This ends up spamming the logs and can obscure real warnings.

Just print the warning once.

Reported-by: Linux Kernel Functional Testing <lkft at linaro.org>
Closes: https://lore.kernel.org/all/CA+G9fYuA643RHHpPnz9Ww7rr3zV5a0y=7_uFcybBSL=QP_sQvQ@mail.gmail.com/
Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
---
 drivers/gpu/drm/drm_rect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index 85c79a38c13a..a992d70b928b 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -135,7 +135,7 @@ static int drm_calc_scale(int src, int dst)
 {
 	int scale = 0;
 
-	if (WARN_ON(src < 0 || dst < 0))
+	if (WARN_ON_ONCE(src < 0 || dst < 0))
 		return -EINVAL;
 
 	if (dst == 0)
-- 
2.42.0



More information about the dri-devel mailing list