Skip to contentSkip to conversation

drm/amd/display: Fix boolean expression in get_surf_rq_param

PATCH In review Gustavo A. R. Silva 3 participants 6 messages Jan 3, 2019 – Mar 22, 2019

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

PATCH 1/1 drm/amd/display: Fix boolean expression in get_surf_rq_param

Fix boolean expression by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes 6d04ee9dc101 ("drm/amd/display: Restructuring and cleaning up DML")
---
 drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +1 -1
index c2037daa8e66..d341b69fdc1a 100644
@@ -881,7 +881,7 @@ static void get_surf_rq_param(
 	/* the dpte_group_bytes is reduced for the specific case of vertical
 	 * access of a tile surface that has dpte request of 8x1 ptes.
 	 */
-	if (!surf_linear & (log2_dpte_req_height_ptes == 0) & surf_vert) /*reduced, in this case, will have page fault within a group */
+	if (!surf_linear && (log2_dpte_req_height_ptes == 0) && surf_vert) /*reduced, in this case, will have page fault within a group */
 		rq_sizing_param->dpte_group_bytes = 512;
 	else
 		/*full size */
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

Fix boolean expression by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes 6d04ee9dc101 ("drm/amd/display: Restructuring and cleaning up DML")

and applied.

Harry

Quoted 10 lines
---
 drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +0 -0
index c2037daa8e66..d341b69fdc1a 100644

drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c static void get_surf_rq_param( · line 887

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +1 -1
@@ -881,7 +881,7 @@ static void get_surf_rq_param(
 	/* the dpte_group_bytes is reduced for the specific case of vertical
 	 * access of a tile surface that has dpte request of 8x1 ptes.
 	 */
-	if (!surf_linear & (log2_dpte_req_height_ptes == 0) & surf_vert) /*reduced, in this case, will have page fault within a group */
+	if (!surf_linear && (log2_dpte_req_height_ptes == 0) && surf_vert) /*reduced, in this case, will have page fault within a group */
 		rq_sizing_param->dpte_group_bytes = 512;
 	else
 		/*full size */

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

#2 lore raw
Quoted 6 lines · Harry
Quoted 5 lines · Gustavo A. R. Silva

Fix boolean expression by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Quoted 8 lines
Quoted 3 lines
Fixes 6d04ee9dc101 ("drm/amd/display: Restructuring and cleaning up DML")

and applied.

Thanks, Harry.

--
Gustavo

#3 lore raw
In reply to Wentland, Harry

Hi Harry,

I noticed this patch is already in mainline, but the stable tag was removed. What is the reason for that if this bug is present in stable?

Thanks
--
Gustavo

Quoted 34 lines · Harry
Quoted 8 lines · Gustavo A. R. Silva

Fix boolean expression by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes 6d04ee9dc101 ("drm/amd/display: Restructuring and cleaning up DML")

and applied.

Harry

Quoted 18 lines
---
 drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +1 -1
index c2037daa8e66..d341b69fdc1a 100644
@@ -881,7 +881,7 @@ static void get_surf_rq_param(
 	/* the dpte_group_bytes is reduced for the specific case of vertical
 	 * access of a tile surface that has dpte request of 8x1 ptes.
 	 */
-	if (!surf_linear & (log2_dpte_req_height_ptes == 0) & surf_vert) /*reduced, in this case, will have page fault within a group */
+	if (!surf_linear && (log2_dpte_req_height_ptes == 0) && surf_vert) /*reduced, in this case, will have page fault within a group */
 		rq_sizing_param->dpte_group_bytes = 512;
 	else
 		/*full size */
#4 lore raw
Quoted 5 lines · Gustavo A. R. Silva

Hi Harry,

I noticed this patch is already in mainline, but the stable tag was removed. What is the reason for that if this bug is present in stable?

It's not a bug, it's just a style issue and
the && use in some compilers it may be slower.

bool when set is 1.

#5 lore raw
Quoted 10 lines · Joe Perches
Quoted 5 lines · Gustavo A. R. Silva

Hi Harry,

I noticed this patch is already in mainline, but the stable tag was removed. What is the reason for that if this bug is present in stable?

It's not a bug, it's just a style issue and
the && use in some compilers it may be slower.

You're right. What might be a bug in some cases
is the other way around.

Thanks, Joe.

--
Gustavo