2024-02-02 08:52:29

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH] drm/amd/display: Simplify the calculation of variables

/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c:236:49-51: WARNING !A || A && B is equivalent to !A || B.

Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8169
Signed-off-by: Jiapeng Chong <[email protected]>
---
drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
index 1068b962d1c1..f15d1dbad6a9 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
@@ -234,7 +234,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state
if (state->streams[i]->stream_id == stream_id) {
for (j = 0; j < state->stream_status[i].plane_count; j++) {
if (state->stream_status[i].plane_states[j] == plane &&
- (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) {
+ (!is_plane_duplicate || (j == plane_index))) {
*plane_id = (i << 16) | j;
return true;
}
--
2.20.1.7.g153144c



2024-02-02 16:23:47

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drm/amd/display: Simplify the calculation of variables

On Fri, Feb 2, 2024 at 10:13 AM Jiapeng Chong
<[email protected]> wrote:
>
> ./drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c:236:49-51: WARNING !A || A && B is equivalent to !A || B.
>
> Reported-by: Abaci Robot <[email protected]>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8169
> Signed-off-by: Jiapeng Chong <[email protected]>

Applied. Thanks!

Alex

> ---
> drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
> index 1068b962d1c1..f15d1dbad6a9 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
> @@ -234,7 +234,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state
> if (state->streams[i]->stream_id == stream_id) {
> for (j = 0; j < state->stream_status[i].plane_count; j++) {
> if (state->stream_status[i].plane_states[j] == plane &&
> - (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) {
> + (!is_plane_duplicate || (j == plane_index))) {
> *plane_id = (i << 16) | j;
> return true;
> }
> --
> 2.20.1.7.g153144c
>