]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
genirq/devres: Don't free interrupt which is not managed by devres
authorZijun Hu <quic_zijuhu@quicinc.com>
Fri, 18 Oct 2024 12:08:25 +0000 (20:08 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 24 Oct 2024 09:20:06 +0000 (11:20 +0200)
If devres_destroy() does not find a matching devres entry, then
devm_free_irq() emits a warning and tries to free the interrupt.

That's wrong as devm_free_irq() should only undo what devm_request_irq()
set up.

Replace devres_destroy() with a call to devres_release() which only invokes
the release function (free_irq()) in case that a matching devres entry was
found.

[ tglx: Massaged change log ]

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20241018-devres_kernel_fix-v2-1-08918ae84982@quicinc.com
kernel/irq/devres.c

index b3e98668f4dd87e725626ad55f48a34d117e1c67..eb16a58e0322e24354d5858c869231ee2aae304d 100644 (file)
@@ -141,9 +141,8 @@ void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id)
 {
        struct irq_devres match_data = { irq, dev_id };
 
-       WARN_ON(devres_destroy(dev, devm_irq_release, devm_irq_match,
+       WARN_ON(devres_release(dev, devm_irq_release, devm_irq_match,
                               &match_data));
-       free_irq(irq, dev_id);
 }
 EXPORT_SYMBOL(devm_free_irq);