diff mbox

[2/2] gpu: drm: ast: Replace mdelay with msleep in ast_post_chip_2500

Message ID 1523435416-4256-1-git-send-email-baijiaju1990@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jia-Ju Bai April 11, 2018, 8:30 a.m. UTC
ast_post_chip_2500() is never called in atomic context.

The call chains ending up at reset_mmc_2500() are:
[1] ast_post_chip_2500() <- ast_post_gpu() <- ast_drm_thaw()
[2] ast_post_chip_2500() <- ast_post_gpu() <- ast_driver_load()

ast_drm_thaw() calls console_lock() which can sleep.
ast_driver_load() is set as ".load" in struct drm_driver.
These functions are not called in atomic context.

Despite never getting called from atomic context, ast_post_chip_2500()
calls mdelay() to busily wait.
This is not necessary and can be replaced with msleep() to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/gpu/drm/ast/ast_post.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index f7d4213..67c5e50 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -2063,7 +2063,7 @@  void ast_post_chip_2500(struct drm_device *dev)
 		temp  = ast_mindwm(ast, 0x1e6e2070);
 		if (temp & 0x00800000) {
 			ast_moutdwm(ast, 0x1e6e207c, 0x00800000);
-			mdelay(100);
+			msleep(100);
 			ast_moutdwm(ast, 0x1e6e2070, 0x00800000);
 		}