aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-07-30 04:44:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-08-03 13:55:25 -0400
commit3d0ccbaff396920eedeb6a8d0dbb3c95847e937e (patch)
tree3ccae652d3fbab3ef2395195d96141ad5aaa2de3
parent47aff92ce081d8c9013f52e021cdfee5eebdbd2b (diff)
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>
-rw-r--r--drivers/iio/light/lm3533-als.c7
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)
847 return -EINVAL; 847 return -EINVAL;
848 } 848 }
849 849
850 indio_dev = iio_device_alloc(sizeof(*als)); 850 indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*als));
851 if (!indio_dev) 851 if (!indio_dev)
852 return -ENOMEM; 852 return -ENOMEM;
853 853
@@ -870,7 +870,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
870 if (als->irq) { 870 if (als->irq) {
871 ret = lm3533_als_setup_irq(als, indio_dev); 871 ret = lm3533_als_setup_irq(als, indio_dev);
872 if (ret) 872 if (ret)
873 goto err_free_dev; 873 return ret;
874 } 874 }
875 875
876 ret = lm3533_als_setup(als, pdata); 876 ret = lm3533_als_setup(als, pdata);
@@ -894,8 +894,6 @@ err_disable:
894err_free_irq: 894err_free_irq:
895 if (als->irq) 895 if (als->irq)
896 free_irq(als->irq, indio_dev); 896 free_irq(als->irq, indio_dev);
897err_free_dev:
898 iio_device_free(indio_dev);
899 897
900 return ret; 898 return ret;
901} 899}
@@ -910,7 +908,6 @@ static int lm3533_als_remove(struct platform_device *pdev)
910 lm3533_als_disable(als); 908 lm3533_als_disable(als);
911 if (als->irq) 909 if (als->irq)
912 free_irq(als->irq, indio_dev); 910 free_irq(als->irq, indio_dev);
913 iio_device_free(indio_dev);
914 911
915 return 0; 912 return 0;
916} 913}