Re: [PATCH v3] iio: adc: qcom-spmi-iadc: balance enable_irq_wake() on driver unbind

From: Jonathan Cameron

Date: Mon Jul 06 2026 - 12:27:45 EST


On Mon, 6 Jul 2026 13:25:48 +0200
Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx> wrote:

> On 7/4/26 1:04 AM, Jonathan Cameron wrote:
> > On Fri, 29 May 2026 14:56:48 +0500
> > Stepan Ionichev <sozdayvek@xxxxxxxxx> wrote:
> >
> >> iadc_probe() calls enable_irq_wake() after a successful
> >> devm_request_irq(), but the driver has no remove callback or
> >> matching disable_irq_wake(), so the wake reference count on the
> >> IRQ is leaked on module unload or driver unbind.
> >>
> >> Check the IRQ request error first, then register a devm action
> >> that calls disable_irq_wake() so the wake reference is released
> >> in the same scope as the enable. While here, drop the inverted
> >> "if (!ret) ... else return ret" in favour of the standard
> >> "if (ret) return ret;" pattern.
> >>
> >> Fixes: ce0694841ea6 ("iio: iadc: Qualcomm SPMI PMIC current ADC driver")
> >> Signed-off-by: Stepan Ionichev <sozdayvek@xxxxxxxxx>
> >
> > +CC Bjorn and Konrad as we don't seem to have a more specific
> > maintainer for this driver.
> >
> > Seems low risk, but nice to run it past them.
>
> The robot pointed out to me that this makes probe fail if the
> irqchip isn't wakeup-capable, but it seems like that's never the
> case for the one that will be used (i.e. the QC SPMI bus arbiter)
>
> so:
>
> Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>
I'm clearly going crazy. Seems I picked up an earlier version and
failed to track that correctly. It's already upstream and from a quick
eyeball is the same as this patch (I think I must have picked up v1
after v2 discussion showing that was right option).

Thanks anyway and at least this record will exist of that wakeup-capable
thing.

Jonathan

> Konrad