drm/msm/dpu: Fix uninitialized variable
PATCH 1/1 drm/msm/dpu: Fix uninitialized variable
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -1
@@ -1164,7 +1164,7 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret; +int ret =0 ;for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i];
---
base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617
Best regards,
Signature · 1 line
Ethan Carter Edwards <[email protected]>
Quoted 17 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-0
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c int dpu_assign_plane_resources(struct dpu_global_state *global_state, · line 1167
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1
-1@@ -1164,7 +1164,7 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret; +int ret =0 ;
Thanks, but I think it better to make the function return ret from within the loop and return explicit 0 if there was no error.
Quoted 12 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-1for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i]; ---base-commit:
a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617Best regards,
Signature · 1 line
Ethan Carter Edwards <[email protected]>
Signature · 2 lines
With best wishes Dmitry
Quoted 13 lines · Dmitry Baryshkov
Quoted 12 lines · Ethan Carter Edwards
There is a possibility for an uninitialized *ret* variable to be returned in some code paths.
Fix this by initializing *ret* to 0.
Addresses-Coverity-ID: 1642546 ("Uninitialized scalar variable")
Fixes 774bcfb731765d ("drm/msm/dpu: add support for virtual planes")Signed-off-by Ethan Carter Edwards <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c int dpu_assign_plane_resources(struct dpu_global_state *global_state, · line 1167
Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1
-1@@ -1164,7 +1164,7 @@ int dpu_assign_plane_resources(struct dpu_global_state *global_state, unsigned int num_planes) {unsigned int i; -int ret; +int ret =0 ;Thanks, but I think it better to make the function return ret from within the loop and return explicit 0 if there was no error.
Will do, v2 incoming...
Quoted 17 lines
Quoted 13 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0
-1for (i =0 ; i < num_planes; i++) {struct drm_plane_state *plane_state = states[i]; ---base-commit:
a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250209-dpu-c3fac78fc617Best regards,
Signature · 1 line
Ethan Carter Edwards <[email protected]>Signature · 2 lines
With best wishes Dmitry