diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-07-30 12:44:00 +0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 21:55:25 +0400 |
commit | 3d0ccbaff396920eedeb6a8d0dbb3c95847e937e (patch) | |
tree | 3ccae652d3fbab3ef2395195d96141ad5aaa2de3 /drivers/iio/light/lm3533-als.c | |
parent | 47aff92ce081d8c9013f52e021cdfee5eebdbd2b (diff) | |
download | linux-3d0ccbaff396920eedeb6a8d0dbb3c95847e937e.tar.xz |
iio: light: lm3533-als: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light/lm3533-als.c')
-rw-r--r-- | drivers/iio/light/lm3533-als.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c index 5fa31a4ef82a..c1aadc6b865a 100644 --- a/drivers/iio/light/lm3533-als.c +++ b/drivers/iio/light/lm3533-als.c @@ -847,7 +847,7 @@ static int lm3533_als_probe(struct platform_device *pdev) return -EINVAL; } - indio_dev = iio_device_alloc(sizeof(*als)); + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*als)); if (!indio_dev) return -ENOMEM; @@ -870,7 +870,7 @@ static int lm3533_als_probe(struct platform_device *pdev) if (als->irq) { ret = lm3533_als_setup_irq(als, indio_dev); if (ret) - goto err_free_dev; + return ret; } ret = lm3533_als_setup(als, pdata); @@ -894,8 +894,6 @@ err_disable: err_free_irq: if (als->irq) free_irq(als->irq, indio_dev); -err_free_dev: - iio_device_free(indio_dev); return ret; } @@ -910,7 +908,6 @@ static int lm3533_als_remove(struct platform_device *pdev) lm3533_als_disable(als); if (als->irq) free_irq(als->irq, indio_dev); - iio_device_free(indio_dev); return 0; } |