Skip to contentSkip to conversation

drm/sprd: add Unisoc's drm kms master

bug report Dan Carpenter 2 participants 2 messages Dec 15, 2021 – Dec 18, 2021

lore
Share & tools
lore
#0 lore raw

Hello Kevin Tang,

This is a semi-automatic email about new static checker warnings.

The patch 43531edd53f0: "drm/sprd: add Unisoc's drm kms master" from Dec 7, 2021, leads to the following Smatch complaint:

drivers/gpu/drm/sprd/sprd_drm.c:158 sprd_drm_shutdown()
error: we previously assumed 'drm' could be null (see line 157)

drivers/gpu/drm/sprd/sprd_drm.c
153 static void sprd_drm_shutdown(struct platform_device *pdev)
154 {
155 struct drm_device *drm = platform_get_drvdata(pdev);
156

   157                if (!drm) {
                          ^^^^

"drm" is NULL

158 drm_warn(drm, "drm device is not available, no shutdown\n");

                                       ^^^

This dereferences it. drm is set in bind().

   159                        return;
   160                }
   161
   162                drm_atomic_helper_shutdown(drm);
   163        }

regards,
dan carpenter

#1 lore raw

Dear Dan,
Thank you for your notice. I have received it. I will be fix it later.

Best wishes

Quoted 32 lines · Dan Carpenter <[email protected]> 于2021年12月15日周三 19:32写道:

Hello Kevin Tang,

This is a semi-automatic email about new static checker warnings.

The patch 43531edd53f0: "drm/sprd: add Unisoc's drm kms master" from Dec 7, 2021, leads to the following Smatch complaint:

drivers/gpu/drm/sprd/sprd_drm.c:158 sprd_drm_shutdown()
error: we previously assumed 'drm' could be null (see line 157)

drivers/gpu/drm/sprd/sprd_drm.c
153 static void sprd_drm_shutdown(struct platform_device *pdev)

   154        {
   155                struct drm_device *drm = platform_get_drvdata(pdev);
   156
   157                if (!drm) {
                          ^^^^

"drm" is NULL

   158                        drm_warn(drm, "drm device is not available, no shutdown\n");
                                       ^^^

This dereferences it. drm is set in bind().

   159                        return;
   160                }
   161
   162                drm_atomic_helper_shutdown(drm);
   163        }

regards,
dan carpenter