linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH 2/3] Input: wm831x-ts - Convert to devm_kzalloc()
Date: Thu, 11 Oct 2012 00:39:55 -0700	[thread overview]
Message-ID: <20121011073955.GA30395@core.coreip.homeip.net> (raw)
In-Reply-To: <1349875236-5707-2-git-send-email-broonie@opensource.wolfsonmicro.com>

On Wed, Oct 10, 2012 at 10:20:35PM +0900, Mark Brown wrote:
> Saves a little code and eliminates the possibility of introducing some
> leaks.
> 

*sigh* OK, I guess devm_* is here to stay and I have to get on with the
program. I am still unhappy that half of the patches converting/using
devm_* APIs are wrong (not these ones), but I will apply these 3.

Thanks.

> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/input/touchscreen/wm831x-ts.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c
> index bf0a4a6..c7eee56 100644
> --- a/drivers/input/touchscreen/wm831x-ts.c
> +++ b/drivers/input/touchscreen/wm831x-ts.c
> @@ -245,7 +245,8 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev)
>  	if (core_pdata)
>  		pdata = core_pdata->touch;
>  
> -	wm831x_ts = kzalloc(sizeof(struct wm831x_ts), GFP_KERNEL);
> +	wm831x_ts = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ts),
> +				 GFP_KERNEL);
>  	input_dev = input_allocate_device();
>  	if (!wm831x_ts || !input_dev) {
>  		error = -ENOMEM;
> @@ -376,7 +377,6 @@ err_data_irq:
>  	free_irq(wm831x_ts->data_irq, wm831x_ts);
>  err_alloc:
>  	input_free_device(input_dev);
> -	kfree(wm831x_ts);
>  
>  	return error;
>  }
> @@ -388,7 +388,6 @@ static __devexit int wm831x_ts_remove(struct platform_device *pdev)
>  	free_irq(wm831x_ts->pd_irq, wm831x_ts);
>  	free_irq(wm831x_ts->data_irq, wm831x_ts);
>  	input_unregister_device(wm831x_ts->input_dev);
> -	kfree(wm831x_ts);
>  
>  	return 0;
>  }
> -- 
> 1.7.10.4
> 

-- 
Dmitry

  reply	other threads:[~2012-10-11  7:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 13:20 [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data Mark Brown
2012-10-10 13:20 ` [PATCH 2/3] Input: wm831x-ts - Convert to devm_kzalloc() Mark Brown
2012-10-11  7:39   ` Dmitry Torokhov [this message]
2012-10-11  8:07     ` Mark Brown
2012-10-11  8:27       ` Dmitry Torokhov
2012-10-11  8:33         ` Mark Brown
2012-10-11 16:22           ` Dmitry Torokhov
2012-10-10 13:20 ` [PATCH 3/3] Input: wm831x-on " Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2012-04-18 17:28 [PATCH 1/3] Input: wm831x-ts - Remove unneeded clearing of driver data Mark Brown
2012-04-18 17:28 ` [PATCH 2/3] Input: wm831x-ts - Convert to devm_kzalloc() 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=20121011073955.GA30395@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.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 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).