Re: [PATCH] iio: proximity: hx9023s: Allocate trigger before requesting IRQ

From: Jonathan Cameron

Date: Sat Oct 17 2026 - 15:57:56 EST


On Fri, 16 Oct 2026 20:25:24 +0200
Joshua Crofts <joshua.crofts1@xxxxxxxxx> wrote:

> On Thu, 15 Oct 2026 22:47:35 -0400
> Myeonghun Pak <mhun512@xxxxxxxxx> wrote:
>
> > An IRQ handler that already read trigger_enabled can poll data->trig
> > after buffer disable. Detaching the virtual IRQ does not join this
> > physical IRQ, and trigger deselection can drop the consumer reference.
> > Devres may then free the trigger before joining the handler.
> >
> > Allocate the trigger before requesting the IRQ so devres joins the
> > handler before dropping the allocation reference.
> >
> > This issue was identified as part of our ongoing research while
> > reviewing kernel code.
> >
> > Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
> > Assisted-by: LLM
> > Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
> > ---
>
> LGTM.
>
> Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
Applied to the fixes-togreg branch of iio.git and marked
for stable.

Thanks,

Jonathan

>