Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] iio: adc: max1027: fix not unregistered iio trigger
@ 2019-11-18 11:40 Chuhong Yuan
  2019-11-23 16:29 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-11-18 11:40 UTC (permalink / raw)
  To: unlisted-recipients:; (no To-header on input)
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel, Chuhong Yuan

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>
---
 drivers/iio/adc/max1027.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 214883458582..8caead7dffa5 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -446,7 +446,12 @@ 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(&spi->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,
-- 
2.24.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: adc: max1027: fix not unregistered iio trigger
  2019-11-18 11:40 [PATCH] iio: adc: max1027: fix not unregistered iio trigger Chuhong Yuan
@ 2019-11-23 16:29 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2019-11-23 16:29 UTC (permalink / raw)
  To: Chuhong Yuan
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On Mon, 18 Nov 2019 19:40:18 +0800
Chuhong Yuan <hslester96@gmail.com> wrote:

> 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>
Hi.

This has crossed with some other patches to the driver, but the fix
is still applicable.  If we want to push this back to older stable
branches we will need to do manual backports.

Adjusted version applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/max1027.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 214883458582..8caead7dffa5 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -446,7 +446,12 @@ 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(&spi->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,


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 11:40 [PATCH] iio: adc: max1027: fix not unregistered iio trigger Chuhong Yuan
2019-11-23 16:29 ` Jonathan Cameron

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git