[bug report] drm/amd/display: move eDP panel control logic to link_edp_panel_control

Dan Carpenter error27 at gmail.com
Wed Mar 22 09:33:34 UTC 2023


The recent function renames made these warnings show up as new again:

drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:358
edp_receiver_ready_T9() warn: potential negative cast to bool 'result'

drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:393
edp_receiver_ready_T7() warn: potential negative cast to bool 'result'

drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c
    336 bool edp_receiver_ready_T9(struct dc_link *link)
    337 {
    338         unsigned int tries = 0;
    339         unsigned char sinkstatus = 0;
    340         unsigned char edpRev = 0;
    341         enum dc_status result = DC_OK;
    342 
    343         result = core_link_read_dpcd(link, DP_EDP_DPCD_REV, &edpRev, sizeof(edpRev));
    344 
    345         /* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/
    346         if (result == DC_OK && edpRev >= DP_EDP_12) {
    347                 do {
    348                         sinkstatus = 1;
    349                         result = core_link_read_dpcd(link, DP_SINK_STATUS, &sinkstatus, sizeof(sinkstatus));
    350                         if (sinkstatus == 0)
    351                                 break;
    352                         if (result != DC_OK)
    353                                 break;
    354                         udelay(100); //MAx T9
    355                 } while (++tries < 50);
    356         }
    357 
--> 358         return result;
                       ^^^^^^
result is a non-zero enum so this always returns true.  Which is fine
because the caller doesn't check.

    359 }

regards,
dan carpenter


More information about the amd-gfx mailing list