]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/display: Incorrect 'not' operator usage
authorClay King <clayking@amd.com>
Thu, 14 Aug 2025 21:02:45 +0000 (17:02 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 27 Aug 2025 17:57:50 +0000 (13:57 -0400)
Consolidating multiple CodeQL Fixes for alerts with rule id: cpp/incorrect-not-operator-usage

Reviewed-by: Joshua Aberback <joshua.aberback@amd.com>
Signed-off-by: Clay King <clayking@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_sw.c
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c

index 0421b267a0b5fe40f7825fca0f0b330bdad16948..365dd2e37aea60cb8e5967f0079a3f00cc7f2365 100644 (file)
@@ -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;
 
index e188447c8156b75344ed2d9c4ddab070f880ee9c..2d73b94c515cafbe18aa0eff65ba467f3510df3e 100644 (file)
@@ -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;
 
index 390c1a77fda6a421053fafe0b36fefebb01f67a7..9c58ff1069d6bcde1cea51e8f43209a08ec6a25d 100644 (file)
@@ -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
index 843d6004258ce9c835dfbd281703675191796442..570e6e39eb455da8f66eea90a4eeeac813a749ae 100644 (file)
@@ -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
index 5718000627b08b955a58f5df80e5e2e4ad5458ae..f549da082c014b730c9f8cbc9024994e7f77d590 100644 (file)
@@ -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
index 8d4873f80df023073ce949e1b11b7c856e1f235b..4fb37df54d59f4a1f0097925a66cf02036109bb9 100644 (file)
@@ -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;
index c46bda2141acd5ee9fa41d3ab95dff47cb5450c8..bfeb01477f0c47fbfe4ac21e8ba4ae034751d028 100644 (file)
@@ -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;
index b7d2a0caec11b0bb0d8953d71987306dda6c1be7..04df263ff65ed5be3fb9c948f043d0ef13ddf7a7 100644 (file)
@@ -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;