Skip to contentSkip to conversation

drm/vc4: fix uninitialized smatch warnings

PATCH In review [email protected] 3 participants 3 messages Apr 5, 2025 – Apr 7, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vc4: fix uninitialized smatch warnings

From: sunliming <[email protected]>

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

---
 drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_gem.c +1 -1
index 8125f87edc60..04ea1696fc5d 100644
@@ -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.
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 18 lines · On Sat, Apr 05, 2025 at 10:45:03AM +0800, [email protected] wrote:

From: sunliming <[email protected]>

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

---
 drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_gem.c +0 -0
index 8125f87edc60..04ea1696fc5d 100644

drivers/gpu/drm/vc4/vc4_gem.c static int · line 588

Quoted 8 lines
drivers/gpu/drm/vc4/vc4_gem.c +1 -1
@@ -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

#2 lore raw
Quoted 25 lines · Maxime Ripard
Quoted 24 lines · On Sat, Apr 05, 2025 at 10:45:03AM +0800, [email protected] wrote:

From: sunliming <[email protected]>

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

---
 drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_gem.c +1 -1
index 8125f87edc60..04ea1696fc5d 100644
@@ -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;
 
Quoted 5 lines

drivers/gpu/drm/vc4/vc4_gem.c static int · line 588

Quoted 2 lines
drivers/gpu/drm/vc4/vc4_gem.c +0 -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