Skip to contentSkip to conversation

drm/amd/display: Fix identical code for different branches

PATCH In review Len Baker 2 participants 3 messages Jul 11, 2021 – Jul 16, 2021

Subsystems (3)
lore
Share & tools
lore

Len Baker

author
#0 lore raw

PATCH 1/1 drm/amd/display: Fix identical code for different branches

The branches of the "if" statement are the same. So remove the unnecessary if and goto statements.

Addresses-Coverity-ID: 1456916 ("Identical code for different branches")

Fixes 4c283fdac08ab ("drm/amd/display: Add HDCP module")
---
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +2 -4
index de872e7958b0..d0c565567102 100644
@@ -305,10 +305,8 @@ static enum mod_hdcp_status wait_for_ready(struct mod_hdcp *hdcp,
 				hdcp, "bcaps_read"))
 			goto out;
 	}
-	if (!mod_hdcp_execute_and_set(check_ksv_ready,
-			&input->ready_check, &status,
-			hdcp, "ready_check"))
-		goto out;
+	mod_hdcp_execute_and_set(check_ksv_ready, &input->ready_check, &status,
+				 hdcp, "ready_check");
 out:
 	return status;
 }

--
2.25.1

#1 lore raw
Quoted 6 lines · Len Baker

The branches of the "if" statement are the same. So remove the unnecessary if and goto statements.

Addresses-Coverity-ID: 1456916 ("Identical code for different branches")

Fixes 4c283fdac08ab ("drm/amd/display: Add HDCP module")

I'm not a big fan of this type of change.

It's currently the same style used for six tests in this function and changing this last one would just make it harder to see the code blocks as consistent.

I doubt any reasonable compiler would produce different objects.

drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c

Quoted 1 line
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +0 -0

[]

Quoted 16 lines
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +2 -4
@@ -305,10 +305,8 @@ static enum mod_hdcp_status wait_for_ready(struct mod_hdcp *hdcp,
  				hdcp, "bcaps_read"))
  			goto out;
  	}
-	if (!mod_hdcp_execute_and_set(check_ksv_ready,
-			&input->ready_check, &status,
-			hdcp, "ready_check"))
-		goto out;
+	mod_hdcp_execute_and_set(check_ksv_ready, &input->ready_check, &status,
+				 hdcp, "ready_check");

 out:
  return status;
 }
--
2.25.1

author
#2 lore raw
Quoted 8 lines · Joe Perches
Quoted 6 lines · Len Baker

The branches of the "if" statement are the same. So remove the unnecessary if and goto statements.

Addresses-Coverity-ID: 1456916 ("Identical code for different branches")

Fixes 4c283fdac08ab ("drm/amd/display: Add HDCP module")
Quoted 7 lines

I'm not a big fan of this type of change.

It's currently the same style used for six tests in this function and changing this last one would just make it harder to see the code blocks as consistent.

I doubt any reasonable compiler would produce different objects.

Ok, thanks for the review. I leave it as is.

Quoted 18 lines

drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c

Quoted 1 line
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +0 -0

[]

Quoted 10 lines
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +2 -4
@@ -305,10 +305,8 @@ static enum mod_hdcp_status wait_for_ready(struct mod_hdcp *hdcp,
  				hdcp, "bcaps_read"))
  			goto out;
  	}
-	if (!mod_hdcp_execute_and_set(check_ksv_ready,
-			&input->ready_check, &status,
-			hdcp, "ready_check"))
-		goto out;
+	mod_hdcp_execute_and_set(check_ksv_ready, &input->ready_check, &status,
+				 hdcp, "ready_check");
Quoted 6 lines

 out:
  return status;
 }
--
2.25.1

Thanks,
Len