All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] msm: iommu: no need kfree before kzalloc successful
@ 2013-05-05 10:07 Libo Chen
  0 siblings, 0 replies; only message in thread
From: Libo Chen @ 2013-05-05 10:07 UTC (permalink / raw)
  To: davidb, ohad, joerg.roedel, akpm, torvalds
  Cc: linux-kernel, lizefan, libo.chen

From: libo.chen@huawei.com

We don`t need to kfree drvdata before kzalloc successful

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/iommu/msm_iommu_dev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/msm_iommu_dev.c b/drivers/iommu/msm_iommu_dev.c
index 4351a2d..c6c6de1 100644
--- a/drivers/iommu/msm_iommu_dev.c
+++ b/drivers/iommu/msm_iommu_dev.c
@@ -293,20 +293,20 @@ static int msm_iommu_ctx_probe(struct
platform_device *pdev)
 	int i, ret;
 	if (!c || !pdev->dev.parent) {
 		ret = -EINVAL;
-		goto fail;
+		goto out;
 	}

 	drvdata = dev_get_drvdata(pdev->dev.parent);

 	if (!drvdata) {
 		ret = -ENODEV;
-		goto fail;
+		goto out;
 	}

 	ctx_drvdata = kzalloc(sizeof(*ctx_drvdata), GFP_KERNEL);
 	if (!ctx_drvdata) {
 		ret = -ENOMEM;
-		goto fail;
+		goto out;
 	}
 	ctx_drvdata->num = c->num;
 	ctx_drvdata->pdev = pdev;
@@ -359,6 +359,7 @@ static int msm_iommu_ctx_probe(struct
platform_device *pdev)
 	return 0;
 fail:
 	kfree(ctx_drvdata);
+out:
 	return ret;
 }

-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-05 10:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-05 10:07 [PATCH 2/2] msm: iommu: no need kfree before kzalloc successful Libo Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.