drm/msm: Delete unnecessary checks before drm_gem_object_unreference_unlocked()
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 13 Jul 2016 17:15:35 +0000 (19:15 +0200)
committerRob Clark <robdclark@gmail.com>
Sat, 16 Jul 2016 14:29:34 +0000 (10:29 -0400)
The drm_gem_object_unreference_unlocked() function tests whether
its argument is NULL and then returns immediately.
Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
drivers/gpu/drm/msm/msm_fb.c
drivers/gpu/drm/msm/msm_gem.c

index ba8df15605d7792893085787ac1275361321cedd..7b39e89fbc2b488adcfc90745732539e57669dad 100644 (file)
@@ -168,8 +168,7 @@ static void mdp4_destroy(struct msm_kms *kms)
 
        if (mdp4_kms->blank_cursor_iova)
                msm_gem_put_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id);
-       if (mdp4_kms->blank_cursor_bo)
-               drm_gem_object_unreference_unlocked(mdp4_kms->blank_cursor_bo);
+       drm_gem_object_unreference_unlocked(mdp4_kms->blank_cursor_bo);
 
        if (mdp4_kms->rpm_enabled)
                pm_runtime_disable(dev);
index 7919c24c6ddd0f79311ce5164b9e6b3fca9f9d37..95cf8fe72ee503dbdf2295c31c8c24a3576cd582 100644 (file)
@@ -49,8 +49,8 @@ static void msm_framebuffer_destroy(struct drm_framebuffer *fb)
 
        for (i = 0; i < n; i++) {
                struct drm_gem_object *bo = msm_fb->planes[i];
-               if (bo)
-                       drm_gem_object_unreference_unlocked(bo);
+
+               drm_gem_object_unreference_unlocked(bo);
        }
 
        kfree(msm_fb);
index 886cfe0383ff9133d0a493236169fbe4b3c82878..9a713fbb2d01282ad8b3a73beea5e35e3085a0a3 100644 (file)
@@ -875,8 +875,6 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
        return obj;
 
 fail:
-       if (obj)
-               drm_gem_object_unreference_unlocked(obj);
-
+       drm_gem_object_unreference_unlocked(obj);
        return ERR_PTR(ret);
 }