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

From: SF Markus Elfring
Date: Sun Jul 05 2015 - 14:23:09 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/