提交 3d0ccbaf 编写于 作者: S Sachin Kamat 提交者: Jonathan Cameron

iio: light: lm3533-als: Use devm_iio_device_alloc

Using devm_iio_device_alloc makes code simpler.
Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
Cc: Johan Hovold <jhovold@gmail.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 47aff92c
...@@ -847,7 +847,7 @@ static int lm3533_als_probe(struct platform_device *pdev) ...@@ -847,7 +847,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
indio_dev = iio_device_alloc(sizeof(*als)); indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*als));
if (!indio_dev) if (!indio_dev)
return -ENOMEM; return -ENOMEM;
...@@ -870,7 +870,7 @@ static int lm3533_als_probe(struct platform_device *pdev) ...@@ -870,7 +870,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
if (als->irq) { if (als->irq) {
ret = lm3533_als_setup_irq(als, indio_dev); ret = lm3533_als_setup_irq(als, indio_dev);
if (ret) if (ret)
goto err_free_dev; return ret;
} }
ret = lm3533_als_setup(als, pdata); ret = lm3533_als_setup(als, pdata);
...@@ -894,8 +894,6 @@ static int lm3533_als_probe(struct platform_device *pdev) ...@@ -894,8 +894,6 @@ static int lm3533_als_probe(struct platform_device *pdev)
err_free_irq: err_free_irq:
if (als->irq) if (als->irq)
free_irq(als->irq, indio_dev); free_irq(als->irq, indio_dev);
err_free_dev:
iio_device_free(indio_dev);
return ret; return ret;
} }
...@@ -910,7 +908,6 @@ static int lm3533_als_remove(struct platform_device *pdev) ...@@ -910,7 +908,6 @@ static int lm3533_als_remove(struct platform_device *pdev)
lm3533_als_disable(als); lm3533_als_disable(als);
if (als->irq) if (als->irq)
free_irq(als->irq, indio_dev); free_irq(als->irq, indio_dev);
iio_device_free(indio_dev);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册