Skip to contentSkip to conversation

drm/amd/display: fix the return of the uninitialized value in ret

PATCH Applied Colin King 3 participants 3 messages Mar 2, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 drm/amd/display: fix the return of the uninitialized value in ret

From: Colin Ian King <[email protected]>

Currently if stream->signal is neither SIGNAL_TYPE_DISPLAY_PORT_MST or SIGNAL_TYPE_DISPLAY_PORT then variable ret is uninitialized and this is checked for > 0 at the end of the function. Ret should be initialized, I believe setting it to zero is a correct default.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes bd0c064c161c ("drm/amd/display: Add return code instead of boolean for future use")
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
index 5159399f8239..5750818db8f6 100644
@@ -530,7 +530,7 @@ bool dm_helpers_dp_write_dsc_enable(
 {
 	uint8_t enable_dsc = enable ? 1 : 0;
 	struct amdgpu_dm_connector *aconnector;
-	uint8_t ret;
+	uint8_t ret = 0;
 
 	if (!stream)
 		return false;
Signature · 6 lines
2.30.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Colin King

From: Colin Ian King <[email protected]>

Currently if stream->signal is neither SIGNAL_TYPE_DISPLAY_PORT_MST or SIGNAL_TYPE_DISPLAY_PORT then variable ret is uninitialized and this is checked for > 0 at the end of the function. Ret should be initialized, I believe setting it to zero is a correct default.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes bd0c064c161c ("drm/amd/display: Add return code instead of boolean for future use")

Harry

Quoted 10 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0 -0
index 5159399f8239..5750818db8f6 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c bool dm_helpers_dp_write_dsc_enable( · line 536

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
@@ -530,7 +530,7 @@ bool dm_helpers_dp_write_dsc_enable(
  {
  	uint8_t enable_dsc = enable ? 1 : 0;
  	struct amdgpu_dm_connector *aconnector;
-	uint8_t ret;
+	uint8_t ret = 0;
 
  	if (!stream)
  		return false;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Applied
#2 lore raw

Applied. Thanks!

Alex

Quoted 32 lines · Harry Wentland
Quoted 10 lines · Colin King

From: Colin Ian King <[email protected]>

Currently if stream->signal is neither SIGNAL_TYPE_DISPLAY_PORT_MST or SIGNAL_TYPE_DISPLAY_PORT then variable ret is uninitialized and this is checked for > 0 at the end of the function. Ret should be initialized, I believe setting it to zero is a correct default.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes bd0c064c161c ("drm/amd/display: Add return code instead of boolean for future use")

Harry

Quoted 15 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
index 5159399f8239..5750818db8f6 100644
@@ -530,7 +530,7 @@ bool dm_helpers_dp_write_dsc_enable(
  {
      uint8_t enable_dsc = enable ? 1 : 0;
      struct amdgpu_dm_connector *aconnector;
-     uint8_t ret;
+     uint8_t ret = 0;
 
Quoted 7 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c bool dm_helpers_dp_write_dsc_enable( · line 536

Quoted 3 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0 -0
      if (!stream)
              return false;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel