iio: adc: lp8788_adc: Use devm_* APIs
devm_* APIs are device managed and make code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Milo Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
e59576d4be
commit
8483aa5e0f
|
@ -194,7 +194,7 @@ static int lp8788_adc_probe(struct platform_device *pdev)
|
|||
struct lp8788_adc *adc;
|
||||
int ret;
|
||||
|
||||
indio_dev = iio_device_alloc(sizeof(*adc));
|
||||
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc));
|
||||
if (!indio_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -205,7 +205,7 @@ static int lp8788_adc_probe(struct platform_device *pdev)
|
|||
indio_dev->dev.of_node = pdev->dev.of_node;
|
||||
ret = lp8788_iio_map_register(indio_dev, lp->pdata, adc);
|
||||
if (ret)
|
||||
goto err_iio_map;
|
||||
return ret;
|
||||
|
||||
mutex_init(&adc->lock);
|
||||
|
||||
|
@ -226,8 +226,6 @@ static int lp8788_adc_probe(struct platform_device *pdev)
|
|||
|
||||
err_iio_device:
|
||||
iio_map_array_unregister(indio_dev);
|
||||
err_iio_map:
|
||||
iio_device_free(indio_dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -237,7 +235,6 @@ static int lp8788_adc_remove(struct platform_device *pdev)
|
|||
|
||||
iio_device_unregister(indio_dev);
|
||||
iio_map_array_unregister(indio_dev);
|
||||
iio_device_free(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue