[PATCH] drm/vc4: fix uninitialized smatch warnings

Maxime Ripard mripard at kernel.org
Mon Apr 7 07:13:59 UTC 2025


On Sat, Apr 05, 2025 at 10:45:03AM +0800, sunliming at linux.dev wrote:
> From: sunliming <sunliming at 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 at intel.com>
> Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
> Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
> Signed-off-by: sunliming <sunliming at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20250407/fca20d3e/attachment-0001.sig>


More information about the dri-devel mailing list