Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/hisilicon: Fix DRM_INFO printed issue

This patch fixed the bellow no DRM_INFO is printed issue:

if (!delay_count)
DRM_INFO("phylock and phystopstateclklane is not ready.\n");

There will some printed issues with above info, under certain
circumstances:

If ((BIT(0) | BIT(2)) & val) is never true, break will not happen and
delay_count will be max u32 value (?), and no DRM_INFO is printed.

Also if ((BIT(0) | BIT(2)) & val) is true at the last possible
loop round, break happens, but now delay_count is already zero
( because of earlier delay_count-- ) and DRM_INFO is erroneously
printed.

Thanks to Juha Leppänen, he reports to me this issue.

Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Reported-by: Juha Leppänen <juha_efku@dnainternet.net>

+2 -1
+2 -1
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
··· 430 430 * wait for phy's clock ready 431 431 */ 432 432 delay_count = 100; 433 - while (delay_count--) { 433 + while (delay_count) { 434 434 val = readl(base + PHY_STATUS); 435 435 if ((BIT(0) | BIT(2)) & val) 436 436 break; 437 437 438 438 udelay(1); 439 + delay_count--; 439 440 } 440 441 441 442 if (!delay_count)