From: Clay King <clayk...@amd.com>

Consolidating multiple CodeQL Fixes for alerts with rule id: 
cpp/incorrect-not-operator-usage

Reviewed-by: Joshua Aberback <joshua.aberb...@amd.com>
Signed-off-by: Clay King <clayk...@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pil...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c                 | 2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_i2c_sw.c                 | 2 +-
 .../gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c   | 2 +-
 .../gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c | 2 +-
 .../gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c   | 2 +-
 .../gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c   | 2 +-
 .../gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c   | 2 +-
 .../gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c 
b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
index 0421b267a0b5..365dd2e37aea 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
@@ -591,7 +591,7 @@ static bool dce_i2c_hw_engine_submit_payload(struct 
dce_i2c_hw *dce_i2c_hw,
                        DCE_I2C_TRANSACTION_ACTION_I2C_WRITE;
 
 
-       request.address = (uint8_t) ((payload->address << 1) | !payload->write);
+       request.address = (uint8_t) ((payload->address << 1) | (payload->write 
? 0 : 1));
        request.length = payload->length;
        request.data = payload->data;
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_sw.c 
b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_sw.c
index e188447c8156..2d73b94c515c 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_sw.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_sw.c
@@ -451,7 +451,7 @@ static bool dce_i2c_sw_engine_submit_payload(struct 
dce_i2c_sw *engine,
                        DCE_I2C_TRANSACTION_ACTION_I2C_WRITE_MOT :
                        DCE_I2C_TRANSACTION_ACTION_I2C_WRITE;
 
-       request.address = (uint8_t) ((payload->address << 1) | !payload->write);
+       request.address = (uint8_t) ((payload->address << 1) | (payload->write 
? 0 : 1));
        request.length = payload->length;
        request.data = payload->data;
 
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c
index 390c1a77fda6..9c58ff1069d6 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c
@@ -646,7 +646,7 @@ static void get_meta_and_pte_attr(struct display_mode_lib 
*mode_lib,
 
        // 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
diff --git 
a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c
index 843d6004258c..570e6e39eb45 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c
@@ -646,7 +646,7 @@ static void get_meta_and_pte_attr(struct display_mode_lib 
*mode_lib,
 
        // 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
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c
index 5718000627b0..f549da082c01 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c
@@ -652,7 +652,7 @@ static void get_meta_and_pte_attr(
        if (hostvm_enable)
                rq_sizing_param->dpte_group_bytes = 512;
        else {
-               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
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
index 8d4873f80df0..4fb37df54d59 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
@@ -620,7 +620,7 @@ static void get_meta_and_pte_attr(struct display_mode_lib 
*mode_lib,
        if (hostvm_enable)
                rq_sizing_param->dpte_group_bytes = 512;
        else {
-               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
                        rq_sizing_param->dpte_group_bytes = 2048;
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c
index c46bda2141ac..bfeb01477f0c 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c
@@ -615,7 +615,7 @@ static void get_meta_and_pte_attr(
        if (hostvm_enable)
                rq_sizing_param->dpte_group_bytes = 512;
        else {
-               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
                        rq_sizing_param->dpte_group_bytes = 2048;
diff --git 
a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c
index b7d2a0caec11..04df263ff65e 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c
@@ -703,7 +703,7 @@ static void get_meta_and_pte_attr(
        if (hostvm_enable)
                rq_sizing_param->dpte_group_bytes = 512;
        else {
-               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
                        rq_sizing_param->dpte_group_bytes = 2048;
-- 
2.50.1

Reply via email to