* [PATCH] drm/amd/display: clean up a condition in dmub_psr_copy_settings()
@ 2020-03-12 11:32 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-03-12 11:32 UTC (permalink / raw)
To: Harry Wentland
Cc: David (ChunMing) Zhou, Leo Li, kernel-janitors, Rodrigo Siqueira,
amd-gfx, Nicholas Kazlauskas, David Airlie, Daniel Vetter,
Wyatt Wood, Alex Deucher, Nathan Chancellor, Christian König
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
index 9c88a92bd96a..bc109d4fc6e6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
@@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/amd/display: clean up a condition in dmub_psr_copy_settings()
@ 2020-03-12 11:32 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-03-12 11:32 UTC (permalink / raw)
To: Harry Wentland
Cc: David (ChunMing) Zhou, Leo Li, kernel-janitors, Rodrigo Siqueira,
amd-gfx, Nicholas Kazlauskas, David Airlie, Daniel Vetter,
Wyatt Wood, Alex Deucher, Nathan Chancellor, Christian König
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
index 9c88a92bd96a..bc109d4fc6e6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: clean up a condition in dmub_psr_copy_settings()
2020-03-12 11:32 ` Dan Carpenter
@ 2020-03-12 14:21 ` Alex Deucher
-1 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2020-03-12 14:21 UTC (permalink / raw)
To: Dan Carpenter
Cc: David (ChunMing) Zhou, Leo Li, Rodrigo Siqueira, kernel-janitors,
amd-gfx list, Christian König, David Airlie, Daniel Vetter,
Wyatt Wood, Alex Deucher, Nathan Chancellor, Harry Wentland,
Nicholas Kazlauskas
On Thu, Mar 12, 2020 at 7:32 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied. thanks!
Alex
> ---
> drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> index 9c88a92bd96a..bc109d4fc6e6 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> @@ -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
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: clean up a condition in dmub_psr_copy_settings()
@ 2020-03-12 14:21 ` Alex Deucher
0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2020-03-12 14:21 UTC (permalink / raw)
To: Dan Carpenter
Cc: David (ChunMing) Zhou, Leo Li, Rodrigo Siqueira, kernel-janitors,
amd-gfx list, Christian König, David Airlie, Daniel Vetter,
Wyatt Wood, Alex Deucher, Nathan Chancellor, Harry Wentland,
Nicholas Kazlauskas
On Thu, Mar 12, 2020 at 7:32 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied. thanks!
Alex
> ---
> drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> index 9c88a92bd96a..bc109d4fc6e6 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
> @@ -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
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-12 14:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-12 11:32 [PATCH] drm/amd/display: clean up a condition in dmub_psr_copy_settings() Dan Carpenter
2020-03-12 11:32 ` Dan Carpenter
2020-03-12 14:21 ` Alex Deucher
2020-03-12 14:21 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.