summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/ti_am335x_adc.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-07-23 12:46:00 +0400
committerJonathan Cameron <jic23@kernel.org>2013-08-03 21:41:19 +0400
commita064813079c203094a5a22cc6f74fef547720697 (patch)
tree47d3304512d4f1f01336a7a2f966d557cb5be005 /drivers/iio/adc/ti_am335x_adc.c
parent224b995a88aacbe638b3282a674af5e9082bb770 (diff)
downloadlinux-a064813079c203094a5a22cc6f74fef547720697.tar.xz
iio: adc: ti_am335x_adc: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Rachna Patil <rachna@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc/ti_am335x_adc.c')
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 0ad208a69c29..b53867cb9cdc 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -202,11 +202,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);
@@ -227,7 +227,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)
@@ -239,9 +239,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;
}
@@ -257,8 +254,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;
}