[bug report] drm/amd/display: move eDP panel control logic to link_edp_panel_control
Dan Carpenter
error27 at gmail.com
Thu Jan 26 11:06:54 UTC 2023
Hello Wenjing Liu,
The patch 0078c924e733: "drm/amd/display: move eDP panel control
logic to link_edp_panel_control" from Dec 19, 2022, leads to the
following Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:353
link_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:388
link_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
331 bool link_edp_receiver_ready_T9(struct dc_link *link)
This function returns DC_OK (1) on success or positive on error or -1
on unknown error. So casting it to bool means it always returns true.
332 {
333 unsigned int tries = 0;
334 unsigned char sinkstatus = 0;
335 unsigned char edpRev = 0;
336 enum dc_status result = DC_OK;
337
338 result = core_link_read_dpcd(link, DP_EDP_DPCD_REV, &edpRev, sizeof(edpRev));
339
340 /* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/
341 if (result == DC_OK && edpRev >= DP_EDP_12) {
342 do {
343 sinkstatus = 1;
344 result = core_link_read_dpcd(link, DP_SINK_STATUS, &sinkstatus, sizeof(sinkstatus));
345 if (sinkstatus == 0)
346 break;
347 if (result != DC_OK)
348 break;
349 udelay(100); //MAx T9
350 } while (++tries < 50);
351 }
352
--> 353 return result;
354 }
regards,
dan carpenter
More information about the amd-gfx
mailing list