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

SF Markus Elfring elfring at users.sourceforge.net
Sun Jul 5 11:22:35 PDT 2015


From: Markus Elfring <elfring at users.sourceforge.net>
Date: Sun, 5 Jul 2015 20:15:12 +0200

The functions nvkm_namedb_put() and pci_dev_put() test whether their
argument is NULL and then return 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 at users.sourceforge.net>
---
 drivers/gpu/drm/nouveau/nouveau_drm.c      | 3 +--
 drivers/gpu/drm/nouveau/nvkm/core/handle.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 36b40c9..8ca3d0c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -515,8 +515,7 @@ nouveau_drm_unload(struct drm_device *dev)
 	nouveau_vga_fini(drm);
 
 	nvif_device_fini(&drm->device);
-	if (drm->hdmi_device)
-		pci_dev_put(drm->hdmi_device);
+	pci_dev_put(drm->hdmi_device);
 	nouveau_cli_destroy(&drm->client);
 	return 0;
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/handle.c b/drivers/gpu/drm/nouveau/nvkm/core/handle.c
index dc7ff10..165f3ff 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/handle.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/handle.c
@@ -216,6 +216,5 @@ nvkm_handle_get_cinst(struct nvkm_object *engctx, u32 cinst)
 void
 nvkm_handle_put(struct nvkm_handle *handle)
 {
-	if (handle)
-		nvkm_namedb_put(handle);
+	nvkm_namedb_put(handle);
 }
-- 
2.4.5



More information about the dri-devel mailing list