drm/sprd: fix potential NULL dereference
authorKevin Tang <kevin3.tang@gmail.com>
Sun, 16 Jan 2022 15:55:47 +0000 (23:55 +0800)
committerkevin3.tang <kevin3.tang@gmail.com>
Mon, 14 Feb 2022 13:53:14 +0000 (21:53 +0800)
'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference
it, remove this warning log.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kevin Tang <kevin3.tang@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/all/20220117084044.9210-1-kevin3.tang@gmail.com
v1 -> v2:
- Split checking platform_get_resource() return value to a separate patch
- Use dev_warn() instead of removing the warning log

drivers/gpu/drm/sprd/sprd_drm.c

index 286edae951891135b4fda9723c890f38052bd0c7..a60ecdd67d98261ba86b0bdff9ecd2901e6bf693 100644 (file)
@@ -154,7 +154,7 @@ static void sprd_drm_shutdown(struct platform_device *pdev)
        struct drm_device *drm = platform_get_drvdata(pdev);
 
        if (!drm) {
-               drm_warn(drm, "drm device is not available, no shutdown\n");
+               dev_warn(&pdev->dev, "drm device is not available, no shutdown\n");
                return;
        }