[PATCH 1/2] vfio: powerpc/spapr: Delete an unnecessary check before the function call "kfree"

SF Markus Elfring
2015-06-28T16:22:50Z

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 28 Jun 2015 17:43:48 +0200

The kfree() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/vfio/vfio_iommu_spapr_tce.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index 0582b72..50ddfac 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -1215,7 +1215,7 @@ static int tce_iommu_attach_group(void *iommu_data,
}

unlock_exit:
- if (ret && tcegrp)
+ if (ret)
kfree(tcegrp);

mutex_unlock(&container->lock);
--
2.4.4