* [bug report] drm/amd/display: move eDP panel control logic to link_edp_panel_control
@ 2023-03-22 9:33 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2023-03-22 9:33 UTC (permalink / raw)
To: Wenjing Liu; +Cc: amd-gfx
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [bug report] drm/amd/display: move eDP panel control logic to link_edp_panel_control
@ 2023-01-26 11:06 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2023-01-26 11:06 UTC (permalink / raw)
To: wenjing.liu; +Cc: amd-gfx
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-22 13:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 9:33 [bug report] drm/amd/display: move eDP panel control logic to link_edp_panel_control Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2023-01-26 11:06 Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.