public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vc4: fix uninitialized smatch warnings
@ 2025-04-05  2:45 sunliming
  2025-04-07  7:13 ` Maxime Ripard
  0 siblings, 1 reply; 3+ messages in thread
From: sunliming @ 2025-04-05  2:45 UTC (permalink / raw)
  To: mripard, dave.stevenson, mcanal, kernel-list, maarten.lankhorst,
	tzimmermann, airlied, simona
  Cc: dri-devel, linux-kernel, sunliming, kernel test robot,
	Dan Carpenter

From: sunliming <sunliming@kylinos.cn>

Fix below smatch warnings:
drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 8125f87edc60..04ea1696fc5d 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -582,7 +582,7 @@ static int
 vc4_lock_bo_reservations(struct vc4_exec_info *exec,
 			 struct drm_exec *exec_ctx)
 {
-	int ret;
+	int ret = 0;
 
 	/* Reserve space for our shared (read-only) fence references,
 	 * before we commit the CL to the hardware.
-- 
2.25.1


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

* Re: [PATCH] drm/vc4: fix uninitialized smatch warnings
  2025-04-05  2:45 [PATCH] drm/vc4: fix uninitialized smatch warnings sunliming
@ 2025-04-07  7:13 ` Maxime Ripard
  2025-04-07  8:56   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2025-04-07  7:13 UTC (permalink / raw)
  To: sunliming
  Cc: dave.stevenson, mcanal, kernel-list, maarten.lankhorst,
	tzimmermann, airlied, simona, dri-devel, linux-kernel, sunliming,
	kernel test robot, Dan Carpenter

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

On Sat, Apr 05, 2025 at 10:45:03AM +0800, sunliming@linux.dev wrote:
> From: sunliming <sunliming@kylinos.cn>
> 
> Fix below smatch warnings:
> drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
> Signed-off-by: sunliming <sunliming@kylinos.cn>
> ---
>  drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index 8125f87edc60..04ea1696fc5d 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -582,7 +582,7 @@ static int
>  vc4_lock_bo_reservations(struct vc4_exec_info *exec,
>  			 struct drm_exec *exec_ctx)
>  {
> -	int ret;
> +	int ret = 0;
>  
>  	/* Reserve space for our shared (read-only) fence references,
>  	 * before we commit the CL to the hardware.

I don't see a code path where ret is used without being initialized. Can
you clarify that in the commit log?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

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

* Re: [PATCH] drm/vc4: fix uninitialized smatch warnings
  2025-04-07  7:13 ` Maxime Ripard
@ 2025-04-07  8:56   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-04-07  8:56 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: sunliming, dave.stevenson, mcanal, kernel-list, maarten.lankhorst,
	tzimmermann, airlied, simona, dri-devel, linux-kernel, sunliming,
	kernel test robot

On Mon, Apr 07, 2025 at 09:13:59AM +0200, Maxime Ripard wrote:
> On Sat, Apr 05, 2025 at 10:45:03AM +0800, sunliming@linux.dev wrote:
> > From: sunliming <sunliming@kylinos.cn>
> > 
> > Fix below smatch warnings:
> > drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
> > Signed-off-by: sunliming <sunliming@kylinos.cn>
> > ---
> >  drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> > index 8125f87edc60..04ea1696fc5d 100644
> > --- a/drivers/gpu/drm/vc4/vc4_gem.c
> > +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> > @@ -582,7 +582,7 @@ static int
> >  vc4_lock_bo_reservations(struct vc4_exec_info *exec,
> >  			 struct drm_exec *exec_ctx)
> >  {
> > -	int ret;
> > +	int ret = 0;
> >  
> >  	/* Reserve space for our shared (read-only) fence references,
> >  	 * before we commit the CL to the hardware.
> 
> I don't see a code path where ret is used without being initialized. Can
> you clarify that in the commit log?

Apparently the drm_exec_until_all_locked() loop always iterates at least
once.  If you have the cross function database then this is parsed
automatically, but I've also hard coded it as a loop at least once macro
just a 1 minute ago to silence this false positive.s

regards,
dan carpenter



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

end of thread, other threads:[~2025-04-07  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-05  2:45 [PATCH] drm/vc4: fix uninitialized smatch warnings sunliming
2025-04-07  7:13 ` Maxime Ripard
2025-04-07  8:56   ` Dan Carpenter

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