All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-iio@vger.kernel.org, rachna@ti.com
Subject: Re: [PATCH 1/2] iio: adc: ti_am335x_adc: Use devm_iio_device_alloc
Date: Sat, 27 Jul 2013 12:48:17 +0100	[thread overview]
Message-ID: <51F3B381.9030208@kernel.org> (raw)
In-Reply-To: <1374569212-26143-1-git-send-email-sachin.kamat@linaro.org>

On 07/23/13 09:46, Sachin Kamat wrote:
> Using devm_iio_device_alloc makes code simpler.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Rachna Patil <rachna@ti.com>
Applied to the togreg branch of iio.git.

Thanks
> ---
>  drivers/iio/adc/ti_am335x_adc.c |   13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index 4427e8e..a2bf109 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -201,11 +201,11 @@ static int tiadc_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	indio_dev = iio_device_alloc(sizeof(struct tiadc_device));
> +	indio_dev = devm_iio_device_alloc(&pdev->dev,
> +					  sizeof(struct tiadc_device));
>  	if (indio_dev == NULL) {
>  		dev_err(&pdev->dev, "failed to allocate iio device\n");
> -		err = -ENOMEM;
> -		goto err_ret;
> +		return -ENOMEM;
>  	}
>  	adc_dev = iio_priv(indio_dev);
>  
> @@ -226,7 +226,7 @@ static int tiadc_probe(struct platform_device *pdev)
>  
>  	err = tiadc_channel_init(indio_dev, adc_dev->channels);
>  	if (err < 0)
> -		goto err_free_device;
> +		return err;
>  
>  	err = iio_device_register(indio_dev);
>  	if (err)
> @@ -238,9 +238,6 @@ static int tiadc_probe(struct platform_device *pdev)
>  
>  err_free_channels:
>  	tiadc_channels_remove(indio_dev);
> -err_free_device:
> -	iio_device_free(indio_dev);
> -err_ret:
>  	return err;
>  }
>  
> @@ -256,8 +253,6 @@ static int tiadc_remove(struct platform_device *pdev)
>  	step_en = get_adc_step_mask(adc_dev);
>  	am335x_tsc_se_clr(adc_dev->mfd_tscadc, step_en);
>  
> -	iio_device_free(indio_dev);
> -
>  	return 0;
>  }
>  
> 

      parent reply	other threads:[~2013-07-27 10:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23  8:46 [PATCH 1/2] iio: adc: ti_am335x_adc: Use devm_iio_device_alloc Sachin Kamat
2013-07-23  8:46 ` [PATCH 2/2] iio: adc: Update ti_am335x_adc Kconfig entry Sachin Kamat
2013-07-27 11:48   ` Jonathan Cameron
2013-07-27 11:48 ` Jonathan Cameron [this message]

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=51F3B381.9030208@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=rachna@ti.com \
    --cc=sachin.kamat@linaro.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.