From: Jingoo Han <jg1.han@samsung.com>
To: "'Grant Likely'" <grant.likely@secretlab.ca>
Cc: "'Linus Walleij'" <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org,
"'Jingoo Han'" <jg1.han@samsung.com>
Subject: [PATCH 5/6] gpio: mc33880: use devm_kzalloc()
Date: Fri, 15 Mar 2013 18:15:49 +0900 [thread overview]
Message-ID: <006601ce215d$af1f6af0$0d5e40d0$%han@samsung.com> (raw)
In-Reply-To: <006201ce215d$6f133d10$4d39b730$%han@samsung.com>
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/gpio/gpio-mc33880.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
index 6a8fdc2..b161489 100644
--- a/drivers/gpio/gpio-mc33880.c
+++ b/drivers/gpio/gpio-mc33880.c
@@ -101,7 +101,7 @@ static int mc33880_probe(struct spi_device *spi)
if (ret < 0)
return ret;
- mc = kzalloc(sizeof(struct mc33880), GFP_KERNEL);
+ mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL);
if (!mc)
return -ENOMEM;
@@ -143,7 +143,6 @@ static int mc33880_probe(struct spi_device *spi)
exit_destroy:
dev_set_drvdata(&spi->dev, NULL);
mutex_destroy(&mc->lock);
- kfree(mc);
return ret;
}
@@ -159,10 +158,9 @@ static int mc33880_remove(struct spi_device *spi)
dev_set_drvdata(&spi->dev, NULL);
ret = gpiochip_remove(&mc->chip);
- if (!ret) {
+ if (!ret)
mutex_destroy(&mc->lock);
- kfree(mc);
- } else
+ else
dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
ret);
--
1.7.2.5
next prev parent reply other threads:[~2013-03-15 9:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 9:14 [PATCH 1/6] gpio: adp5520: " Jingoo Han
2013-03-15 9:14 ` [PATCH 2/6] gpio: max7300: " Jingoo Han
2013-03-27 8:47 ` Linus Walleij
2013-03-15 9:15 ` [PATCH 3/6] gpio: max7301: " Jingoo Han
2013-03-27 8:48 ` Linus Walleij
2013-03-15 9:15 ` [PATCH 4/6] gpio: max732x: " Jingoo Han
2013-03-27 8:49 ` Linus Walleij
2013-03-15 9:15 ` Jingoo Han [this message]
2013-03-27 8:50 ` [PATCH 5/6] gpio: mc33880: " Linus Walleij
2013-03-15 9:16 ` [PATCH 6/6] gpio: pcf857x: " Jingoo Han
2013-03-27 8:52 ` Linus Walleij
2013-03-27 8:46 ` [PATCH 1/6] gpio: adp5520: " Linus Walleij
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='006601ce215d$af1f6af0$0d5e40d0$%han@samsung.com' \
--to=jg1.han@samsung.com \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®