diff options
Diffstat (limited to 'drivers/iio/adc/ti_am335x_adc.c')
-rw-r--r-- | drivers/iio/adc/ti_am335x_adc.c | 13 |
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 3ceac3e91dde..a952538a1a8b 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -216,11 +216,11 @@ static int tiadc_probe(struct platform_device *pdev) | |||
216 | return -EINVAL; | 216 | return -EINVAL; |
217 | } | 217 | } |
218 | 218 | ||
219 | indio_dev = iio_device_alloc(sizeof(struct tiadc_device)); | 219 | indio_dev = devm_iio_device_alloc(&pdev->dev, |
220 | sizeof(struct tiadc_device)); | ||
220 | if (indio_dev == NULL) { | 221 | if (indio_dev == NULL) { |
221 | dev_err(&pdev->dev, "failed to allocate iio device\n"); | 222 | dev_err(&pdev->dev, "failed to allocate iio device\n"); |
222 | err = -ENOMEM; | 223 | return -ENOMEM; |
223 | goto err_ret; | ||
224 | } | 224 | } |
225 | adc_dev = iio_priv(indio_dev); | 225 | adc_dev = iio_priv(indio_dev); |
226 | 226 | ||
@@ -241,7 +241,7 @@ static int tiadc_probe(struct platform_device *pdev) | |||
241 | 241 | ||
242 | err = tiadc_channel_init(indio_dev, adc_dev->channels); | 242 | err = tiadc_channel_init(indio_dev, adc_dev->channels); |
243 | if (err < 0) | 243 | if (err < 0) |
244 | goto err_free_device; | 244 | return err; |
245 | 245 | ||
246 | err = iio_device_register(indio_dev); | 246 | err = iio_device_register(indio_dev); |
247 | if (err) | 247 | if (err) |
@@ -253,9 +253,6 @@ static int tiadc_probe(struct platform_device *pdev) | |||
253 | 253 | ||
254 | err_free_channels: | 254 | err_free_channels: |
255 | tiadc_channels_remove(indio_dev); | 255 | tiadc_channels_remove(indio_dev); |
256 | err_free_device: | ||
257 | iio_device_free(indio_dev); | ||
258 | err_ret: | ||
259 | return err; | 256 | return err; |
260 | } | 257 | } |
261 | 258 | ||
@@ -271,8 +268,6 @@ static int tiadc_remove(struct platform_device *pdev) | |||
271 | step_en = get_adc_step_mask(adc_dev); | 268 | step_en = get_adc_step_mask(adc_dev); |
272 | am335x_tsc_se_clr(adc_dev->mfd_tscadc, step_en); | 269 | am335x_tsc_se_clr(adc_dev->mfd_tscadc, step_en); |
273 | 270 | ||
274 | iio_device_free(indio_dev); | ||
275 | |||
276 | return 0; | 271 | return 0; |
277 | } | 272 | } |
278 | 273 | ||