mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Libo Chen <libo.chen@huawei.com>
To: <Sonic.Zhang@analog.com>, <wsa@the-dreams.de>
Cc: <uclinux-dist-devel@blackfin.uclinux.org>,
	<linux-kernel@vger.kernel.org>, <linux-i2c@vger.kernel.org>,
	<lizefan@huawei.com>, Libo Chen <libo.chen@huawei.com>
Subject: [PATCH v2 2/2] i2c: pxa: no need release_mem_region before request_mem_region successful
Date: Thu, 9 May 2013 16:27:24 +0800	[thread overview]
Message-ID: <1368088044-20408-3-git-send-email-libo.chen@huawei.com> (raw)
In-Reply-To: <1368088044-20408-1-git-send-email-libo.chen@huawei.com>

When kzalloc fail, there is no reason to release_mem_region

fix confuse tag, add new tag: emem, eirq, edt and make it cleanly

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/i2c/busses/i2c-pxa.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index ea6d45d..a9da954 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1104,18 +1104,18 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	if (ret > 0)
 		ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type);
 	if (ret < 0)
-		goto eclk;
+		goto edt;
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(dev, 0);
 	if (res == NULL || irq < 0) {
 		ret = -ENODEV;
-		goto eclk;
+		goto eirq;
 	}
 
 	if (!request_mem_region(res->start, resource_size(res), res->name)) {
 		ret = -ENOMEM;
-		goto eclk;
+		goto emem;
 	}
 
 	i2c->adap.owner   = THIS_MODULE;
@@ -1207,9 +1207,12 @@ ereqirq:
 eremap:
 	clk_put(i2c->clk);
 eclk:
-	kfree(i2c);
-emalloc:
 	release_mem_region(res->start, resource_size(res));
+emem:
+eirq:
+edt:
+	kfree(i2c);
+emalloc:	
 	return ret;
 }
 
-- 
1.7.1



  parent reply	other threads:[~2013-05-09  8:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09  8:27 [PATCH v2 0/2] i2c: fix two wrong mem release Libo Chen
2013-05-09  8:27 ` [PATCH v2 1/2] i2c: i2c-bfin-twi: don`t free peripheral before it init successful Libo Chen
2013-05-09  8:31   ` Zhang, Sonic
2013-05-09  8:33   ` Zhang, Sonic
2013-05-10  1:01     ` Libo Chen
2013-05-13  8:52       ` Zhang, Sonic
2013-05-09  8:34   ` Zhang, Sonic
2013-05-09  8:27 ` Libo Chen [this message]
2013-05-17  9:43 ` [PATCH v2 0/2] i2c: fix two wrong mem release Wolfram Sang
2013-05-19  2:13   ` Libo Chen

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=1368088044-20408-3-git-send-email-libo.chen@huawei.com \
    --to=libo.chen@huawei.com \
    --cc=Sonic.Zhang@analog.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=wsa@the-dreams.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome