The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix GTT manager warning message
@ 2026-08-08 12:17 Karl Mehltretter
  2026-08-10 13:04 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Mehltretter @ 2026-08-08 12:17 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: Karl Mehltretter, David Airlie, Simona Vetter, amd-gfx, dri-devel,
	linux-kernel, llvm

WARN_ON_ONCE() takes a condition, not a message. The string literal is
always true, so the warning still triggers but the message is never
printed.

Use WARN_ONCE(1, ...) instead to print the message and keep the
once-only behavior.

Found with a Coccinelle script. Clang's -Wstring-conversion also flags
such calls but is not enabled in kernel builds.

Fixes: 7554886daa31 ("drm/amdgpu: Fix size validation for non-exclusive domains (v4)")
Assisted-by: Claude:claude-fable-5 coccinelle
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index f98bfba59a2c..f2ea881d39e3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -565,7 +565,8 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
 
 	if (!man) {
 		if (domain & AMDGPU_GEM_DOMAIN_GTT)
-			WARN_ON_ONCE("GTT domain requested but GTT mem manager uninitialized");
+			WARN_ONCE(1,
+				  "GTT domain requested but GTT mem manager uninitialized");
 		return false;
 	}
 
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: fix GTT manager warning message
  2026-08-08 12:17 [PATCH] drm/amdgpu: fix GTT manager warning message Karl Mehltretter
@ 2026-08-10 13:04 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2026-08-10 13:04 UTC (permalink / raw)
  To: Karl Mehltretter, Alex Deucher
  Cc: David Airlie, Simona Vetter, amd-gfx, dri-devel, linux-kernel,
	llvm



On 8/8/26 14:17, Karl Mehltretter wrote:
> [Sie erhalten nicht häufig E-Mails von kmehltretter@gmail.com. Weitere Informationen, warum dies wichtig ist, finden Sie unter https://aka.ms/LearnAboutSenderIdentification ]
> 
> WARN_ON_ONCE() takes a condition, not a message. The string literal is
> always true, so the warning still triggers but the message is never
> printed.
> 
> Use WARN_ONCE(1, ...) instead to print the message and keep the
> once-only behavior.
> 
> Found with a Coccinelle script. Clang's -Wstring-conversion also flags
> such calls but is not enabled in kernel builds.
> 
> Fixes: 7554886daa31 ("drm/amdgpu: Fix size validation for non-exclusive domains (v4)")
> Assisted-by: Claude:claude-fable-5 coccinelle
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index f98bfba59a2c..f2ea881d39e3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -565,7 +565,8 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
> 
>         if (!man) {
>                 if (domain & AMDGPU_GEM_DOMAIN_GTT)
> -                       WARN_ON_ONCE("GTT domain requested but GTT mem manager uninitialized");
> +                       WARN_ONCE(1,
> +                                 "GTT domain requested but GTT mem manager uninitialized");

As far as I can see that warning is completely superfluous to begin with.

GTT is mandatory to load the FW so we can't enter this without any GTT manager.

Regards,
Christian.

>                 return false;
>         }
> 
> --
> 2.39.5 (Apple Git-154)
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-10 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 12:17 [PATCH] drm/amdgpu: fix GTT manager warning message Karl Mehltretter
2026-08-10 13:04 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox