From: axel.lin@gmail.com (Axel Lin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] [ARM] am300epd: fix resource leak in am300_init_gpio_regs error path
Date: Mon, 07 Mar 2011 13:56:11 +0800 [thread overview]
Message-ID: <1299477371.10486.2.camel@mola> (raw)
In-Reply-To: <1299477315.10486.1.camel@mola>
If gpio_request fails when i > 0, gpios[0] is not freed in current
implementation.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
arch/arm/mach-pxa/am300epd.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
index 993d75e..fa8bad2 100644
--- a/arch/arm/mach-pxa/am300epd.c
+++ b/arch/arm/mach-pxa/am300epd.c
@@ -125,10 +125,7 @@ static int am300_init_gpio_regs(struct broadsheetfb_par *par)
if (err) {
dev_err(&am300_device->dev, "failed requesting "
"gpio %d, err=%d\n", i, err);
- while (i >= DB0_GPIO_PIN)
- gpio_free(i--);
- i = ARRAY_SIZE(gpios) - 1;
- goto err_req_gpio;
+ goto err_req_gpio2;
}
}
@@ -159,9 +156,13 @@ static int am300_init_gpio_regs(struct broadsheetfb_par *par)
return 0;
+err_req_gpio2:
+ while (--i >= DB0_GPIO_PIN)
+ gpio_free(i);
+ i = ARRAY_SIZE(gpios);
err_req_gpio:
- while (i > 0)
- gpio_free(gpios[i--]);
+ while (--i >= 0)
+ gpio_free(gpios[i]);
return err;
}
--
1.7.2
next prev parent reply other threads:[~2011-03-07 5:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-07 5:55 [PATCH 1/2] [ARM] am200epd: fix resource leak in am200_init_gpio_regs error path Axel Lin
2011-03-07 5:56 ` Axel Lin [this message]
2011-03-17 15:06 ` [PATCH 2/2] [ARM] am300epd: fix resource leak in am300_init_gpio_regs " Eric Miao
2011-03-17 15:07 ` [PATCH 1/2] [ARM] am200epd: fix resource leak in am200_init_gpio_regs " Eric Miao
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=1299477371.10486.2.camel@mola \
--to=axel.lin@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).