Linux IIO development
 help / color / mirror / Atom feed
From: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
To: Fan Wu <fanwu01@zju.edu.cn>, jic23@kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, michal.simek@amd.com,
	conall.ogriofa@amd.com, bgolaszewski@baylibre.com,
	DileepKumar.Nagavarapu@amd.com, linux-iio@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] iio: adc: xilinx-xadc: free IRQ before cancelling the unmask worker on unbind
Date: Mon, 10 Aug 2026 23:27:37 +0530	[thread overview]
Message-ID: <c87bd58e-2c23-467e-8ae2-8398052ee8d5@amd.com> (raw)
In-Reply-To: <20260803080343.467906-1-fanwu01@zju.edu.cn>



On 8/3/2026 1:33 PM, Fan Wu wrote:
> The ZYNQ XADC alarm IRQ handler queues zynq_unmask_work via
> schedule_delayed_work(); that work is cleared by a devm callback.
> Register the devm callback before devm_request_irq() so the devres LIFO
> teardown frees the IRQ first, ensuring the handler can no longer queue
> work by the time the workqueue is cleared. Otherwise the handler could
> re-arm the work and run it after the xadc structure has been freed.
> 
> This issue was found by an in-house static analysis tool.
> 
> Fixes: 2a9685d1a3b7 ("iio: adc: xilinx: use more devres helpers and remove remove()")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-5.6
> Reviewed-by: David Lechner <dlechner@baylibre.com>
> Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>

Reviewed-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>

Regards
Sai Krishna


> ---
> 
> Changes in v2: shorten the commit message and replace the multi-line code
> comment with a one-line note, per review feedback from Jonathan Cameron.
> The devm registration reorder (the fix) is unchanged; David Lechner's
> Reviewed-by was obtained on v1.
> 
>   drivers/iio/adc/xilinx-xadc-core.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -1395,13 +1395,14 @@ static int xadc_probe(struct platform_device *pdev)
>   	}
> 
>   	if (irq > 0) {
> -		ret = devm_request_irq(dev, irq, xadc->ops->interrupt_handler,
> -				       0, dev_name(dev), indio_dev);
> +		/* Clear out any work queued by the interrupt */
> +		ret = devm_add_action_or_reset(dev, xadc_cancel_delayed_work,
> +					       &xadc->zynq_unmask_work);
>   		if (ret)
>   			return ret;
> 
> -		ret = devm_add_action_or_reset(dev, xadc_cancel_delayed_work,
> -					       &xadc->zynq_unmask_work);
> +		ret = devm_request_irq(dev, irq, xadc->ops->interrupt_handler,
> +				       0, dev_name(dev), indio_dev);
>   		if (ret)
>   			return ret;
>   	}
> --
> 2.43.0


  reply	other threads:[~2026-08-10 17:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  8:03 [PATCH v2] iio: adc: xilinx-xadc: free IRQ before cancelling the unmask worker on unbind Fan Wu
2026-08-10 17:57 ` Sai Krishna Potthuri [this message]
2026-08-21 23:36   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c87bd58e-2c23-467e-8ae2-8398052ee8d5@amd.com \
    --to=sai.krishna.potthuri@amd.com \
    --cc=DileepKumar.Nagavarapu@amd.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=conall.ogriofa@amd.com \
    --cc=dlechner@baylibre.com \
    --cc=fanwu01@zju.edu.cn \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=nuno.sa@analog.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox