Re: [PATCH] i2c: sh_mobile: request IRQs after mapping registers

From: Andi Shyti

Date: Fri Oct 23 2026 - 18:09:42 EST


Hi Myeounghun,

On Sat, Oct 17, 2026 at 11:35:16PM -0400, Myeonghun Pak wrote:
> The managed IRQ handlers are acquired before the managed register
> mapping, so devres unmaps the registers before freeing the IRQs. A
> transfer wakes its waiter before the ISR's final register read, and
> unregistering the adapter does not synchronize these IRQs. An in-flight
> handler can therefore still access the mapping when it is released
> during driver detach.
>
> With forced-threaded IRQs, the handler can be preempted after waking the
> transfer waiter and before its final ICSR read.
>
> Map the registers before requesting the IRQs so that managed cleanup
> frees and synchronizes all handlers before unmapping their registers.
> Keep IRQs available while unregistering the adapter because client
> removal may perform transfers.
>
> This issue was identified as part of our ongoing research while
> reviewing kernel code.
>
> Fixes: 7fe8a9993337 ("i2c: sh_mobile: devm conversion, irq setup")

Normally, I don't like taking fixes that don't address real
issues, especially speculative AI-generated fixes.

However, this looks like a harmless reordering that seems
correct, although the issue it addresses is rather
hypothetical.

I'll remove the Fixes: tag, since this is purely speculative,
and apply the patch to i2c/i2c.

Thanks,
Andi