From 8483aa5e0f0a4bdf8bdc54d83397715c7adb762d Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 23 Jul 2013 09:58:00 +0100 Subject: [PATCH] iio: adc: lp8788_adc: Use devm_* APIs devm_* APIs are device managed and make code simpler. Signed-off-by: Sachin Kamat Cc: Milo Kim Signed-off-by: Jonathan Cameron --- drivers/iio/adc/lp8788_adc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/lp8788_adc.c b/drivers/iio/adc/lp8788_adc.c index 62bc39e9c94f..5c8c91595f47 100644 --- a/drivers/iio/adc/lp8788_adc.c +++ b/drivers/iio/adc/lp8788_adc.c @@ -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; } -- 2.39.5