diff options
author | Chuhong Yuan <hslester96@gmail.com> | 2019-11-18 19:40:18 +0800 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-12-08 18:10:29 +0000 |
commit | c41d79b74b3b106310b43d68fd5a304735c3369f (patch) | |
tree | 48497a9a1f0d7f2429a8671e775f4ede401b0a1d | |
parent | 1f310f77efa25660fcbf58629a96f8ee6aac85ba (diff) | |
download | linux-c41d79b74b3b106310b43d68fd5a304735c3369f.tar.gz linux-c41d79b74b3b106310b43d68fd5a304735c3369f.tar.bz2 linux-c41d79b74b3b106310b43d68fd5a304735c3369f.zip |
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>
-rw-r--r-- | drivers/iio/adc/max1027.c | 8 |
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, |