[PATCH] GPU-DRM-OMAP: Delete unnecessary checks before two function calls

SF Markus Elfring elfring at users.sourceforge.net
Wed Feb 4 13:25:48 PST 2015


From: Markus Elfring <elfring at users.sourceforge.net>
Date: Wed, 4 Feb 2015 22:22:36 +0100

The functions framebuffer_release() and vunmap() perform also input
parameter validation. Thus the test around their calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring at users.sourceforge.net>
---
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +--
 drivers/gpu/drm/omapdrm/omap_gem.c   | 5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index d292d24..fcc02b0 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -270,8 +270,7 @@ fail_unlock:
 fail:
 
 	if (ret) {
-		if (fbi)
-			framebuffer_release(fbi);
+		framebuffer_release(fbi);
 		if (fb) {
 			drm_framebuffer_unregister_private(fb);
 			drm_framebuffer_remove(fb);
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index aeb91ed..18a4137 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -1292,12 +1292,11 @@ void omap_gem_free_object(struct drm_gem_object *obj)
 		if (omap_obj->pages)
 			omap_gem_detach_pages(obj);
 
-		if (!is_shmem(obj)) {
+		if (!is_shmem(obj))
 			dma_free_writecombine(dev->dev, obj->size,
 					omap_obj->vaddr, omap_obj->paddr);
-		} else if (omap_obj->vaddr) {
+		else
 			vunmap(omap_obj->vaddr);
-		}
 	}
 
 	/* don't free externally allocated syncobj */
-- 
2.2.2



More information about the dri-devel mailing list