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

From: SF Markus Elfring
Date: Sun Jun 28 2015 - 12:22:53 EST


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

--
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/