All of lore.kernel.org
 help / color / mirror / Atom feed
From: Libo Chen <chenlibo.3@gmail.com>
To: davidb@codeaurora.org, ohad@wizery.com, joerg.roedel@amd.com,
	akpm@linux-foundation.org, torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, lizefan@huawei.com, libo.chen@huawei.com
Subject: [PATCH 2/2] msm: iommu: no need kfree before kzalloc successful
Date: Sun, 05 May 2013 18:07:01 +0800	[thread overview]
Message-ID: <51862F45.30206@gmail.com> (raw)

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

                 reply	other threads:[~2013-05-05 10:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51862F45.30206@gmail.com \
    --to=chenlibo.3@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidb@codeaurora.org \
    --cc=joerg.roedel@amd.com \
    --cc=libo.chen@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=ohad@wizery.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.