Re: [PATCH] genirq: Check irq disabled & masked states in irq_shutdown

From: Thomas Gleixner
Date: Sat May 27 2017 - 04:16:53 EST


On Sat, 27 May 2017, jeffy wrote:
> On 05/26/2017 09:20 PM, Thomas Gleixner wrote:
> > On Fri, 26 May 2017, Jeffy Chen wrote:
> >
> > > If irq is already disabled and masked, we would hit a unbalanced irq
> > > shutdown/disable/mask when freeing it.
> >
> > Errr? What exactly is unbalanced? None of the called functions has any
> > counter or whatever.
> >
> > Can you please explain what you are trying to fix?
>
> sorry, i'll try to rewrite the commit message.
>
> for example when a driver(drivers/net/wireless/marvell/mwifiex/main.c) try to
> do these:
>
> devm_request_irq->irq_startup->irq_enable
> disable_irq <-- disabled and masked
> devm_free_irq->irq_shutdown <-- disable it again

This driver is broken as hell. It requests the interrupt _BEFORE_ the whole
thing is initialized. If there is a pending interrupt on that line, it will
explode nicely before it is able to disable the irq. But that's a different
problem.

Thanks,

tglx