summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChuhong Yuan <hslester96@gmail.com>2019-11-18 14:40:18 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-12-08 21:10:29 +0300
commitc41d79b74b3b106310b43d68fd5a304735c3369f (patch)
tree48497a9a1f0d7f2429a8671e775f4ede401b0a1d /drivers
parent1f310f77efa25660fcbf58629a96f8ee6aac85ba (diff)
downloadlinux-c41d79b74b3b106310b43d68fd5a304735c3369f.tar.xz
iio: adc: max1027: fix not unregistered iio trigger
The driver forgets to unregister the iio trigger in probe failure and remove. Use devm API to fix it. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/adc/max1027.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index e171db20c04a..02834ca3e1ce 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -478,7 +478,13 @@ static int max1027_probe(struct spi_device *spi)
st->trig->ops = &max1027_trigger_ops;
st->trig->dev.parent = &spi->dev;
iio_trigger_set_drvdata(st->trig, indio_dev);
- iio_trigger_register(st->trig);
+ ret = devm_iio_trigger_register(&indio_dev->dev,
+ st->trig);
+ if (ret < 0) {
+ dev_err(&indio_dev->dev,
+ "Failed to register iio trigger\n");
+ return ret;
+ }
ret = devm_request_threaded_irq(&spi->dev, spi->irq,
iio_trigger_generic_data_rdy_poll,