Skip to contentSkip to conversation

drm/amd/display: clean up a condition in dmub_psr_copy_settings()

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 12, 2020

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

PATCH 1/1 drm/amd/display: clean up a condition in dmub_psr_copy_settings()

We can remove the NULL check for "res_ctx" and "res_ctx->pipe_ctx[i].stream->link". Also it's nicer to align the conditions using spaces so I re-indented a bit.

Longer explanation: The "res_ctx" pointer points to an address in the middle of a struct so it can't be NULL. For "res_ctx->pipe_ctx[i].stream->link" we know that it is equal to "link" and "link" is non-NULL.

---
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +3 -5
index 9c88a92bd96a..bc109d4fc6e6 100644
@@ -134,11 +134,9 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
 	int i = 0;
 
 	for (i = 0; i < MAX_PIPES; i++) {
-		if (res_ctx &&
-			res_ctx->pipe_ctx[i].stream &&
-			res_ctx->pipe_ctx[i].stream->link &&
-			res_ctx->pipe_ctx[i].stream->link = link &&
-			res_ctx->pipe_ctx[i].stream->link->connector_signal = SIGNAL_TYPE_EDP) {
+		if (res_ctx->pipe_ctx[i].stream &&
+		    res_ctx->pipe_ctx[i].stream->link = link &&
+		    res_ctx->pipe_ctx[i].stream->link->connector_signal = SIGNAL_TYPE_EDP) {
 			pipe_ctx = &res_ctx->pipe_ctx[i];
 			break;
 		}
Signature · 1 line
2.20.1
Applied
#1 lore raw
Quoted 11 lines · Dan Carpenter

We can remove the NULL check for "res_ctx" and "res_ctx->pipe_ctx[i].stream->link". Also it's nicer to align the conditions using spaces so I re-indented a bit.

Longer explanation: The "res_ctx" pointer points to an address in the middle of a struct so it can't be NULL. For "res_ctx->pipe_ctx[i].stream->link" we know that it is equal to "link" and "link" is non-NULL.

Applied. thanks!

Alex

Quoted 30 lines
---
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +3 -6
index 9c88a92bd96a..bc109d4fc6e6 100644
@@ -134,11 +134,9 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
        int i = 0;
 
        for (i = 0; i < MAX_PIPES; i++) {
-               if (res_ctx &&
-                       res_ctx->pipe_ctx[i].stream &&
-                       res_ctx->pipe_ctx[i].stream->link &&
-                       res_ctx->pipe_ctx[i].stream->link = link &&
-                       res_ctx->pipe_ctx[i].stream->link->connector_signal = SIGNAL_TYPE_EDP) {
+               if (res_ctx->pipe_ctx[i].stream &&
+                   res_ctx->pipe_ctx[i].stream->link = link &&
+                   res_ctx->pipe_ctx[i].stream->link->connector_signal = SIGNAL_TYPE_EDP) {
                        pipe_ctx = &res_ctx->pipe_ctx[i];
                        break;
                }
--

2.20.1

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