Re: [PATCH RESEND] misc: Fix irq leak in max8997_muic_probe error path

From: Arnd Bergmann
Date: Mon Mar 26 2012 - 04:39:50 EST


On Monday 26 March 2012, Axel Lin wrote:
>
> Current code does not properly free allocated irqs if request_threaded_irq
> returns error, fix it.
>
> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
> Acked-by: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>

It took me a while to see why this is correct.

Acked-by: Arnd Bergmann <arnd@xxxxxxxx>

Note: It would be nicer to move the dev_err() down into the error path as well
and also fix the message to print the correct irq number, but your patch is
the important part.

Note to the driver maintainers: It looks like there is a race in the
max8997_muic_irq_handler() function assigning the info->irq member
when multiple interrupts come in at the same time. Also, calling
sched_work from a threaded interrupt handler is pointless. I would suggest
fixing both of these by removing the work function and calling moving
its contents into the interrupt handler directly. Please correct me if I
am missing somehting here.

Arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/