From: Marek Vasut <marek.vasut@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: wm831x-on - Convert to devm_kzalloc()
Date: Mon, 26 Dec 2011 20:08:46 +0100 [thread overview]
Message-ID: <201112262008.46507.marek.vasut@gmail.com> (raw)
In-Reply-To: <1324925128-9161-1-git-send-email-broonie@opensource.wolfsonmicro.com>
> Saves a small amount of code and reduces the potential for leaks.
Shouldn't you still be kind and free the memory anyway?
M
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/input/misc/wm831x-on.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/misc/wm831x-on.c
> b/drivers/input/misc/wm831x-on.c index 47f18d6..aee53fb 100644
> --- a/drivers/input/misc/wm831x-on.c
> +++ b/drivers/input/misc/wm831x-on.c
> @@ -76,7 +76,8 @@ static int __devinit wm831x_on_probe(struct
> platform_device *pdev) int irq = platform_get_irq(pdev, 0);
> int ret;
>
> - wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL);
> + wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on),
> + GFP_KERNEL);
> if (!wm831x_on) {
> dev_err(&pdev->dev, "Can't allocate data\n");
> return -ENOMEM;
> @@ -120,7 +121,6 @@ err_irq:
> err_input_dev:
> input_free_device(wm831x_on->dev);
> err:
> - kfree(wm831x_on);
> return ret;
> }
>
> @@ -132,7 +132,6 @@ static int __devexit wm831x_on_remove(struct
> platform_device *pdev) free_irq(irq, wm831x_on);
> cancel_delayed_work_sync(&wm831x_on->work);
> input_unregister_device(wm831x_on->dev);
> - kfree(wm831x_on);
>
> return 0;
> }
next prev parent reply other threads:[~2011-12-26 19:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-26 18:45 [PATCH] Input: wm831x-on - Convert to devm_kzalloc() Mark Brown
2011-12-26 19:08 ` Marek Vasut [this message]
2011-12-26 19:26 ` Mark Brown
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=201112262008.46507.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@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 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.