genirq: Release resources in __setup_irq() error path
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 10 Jun 2017 22:38:36 +0000 (00:38 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 12 Jun 2017 22:40:39 +0000 (00:40 +0200)
In case __irq_set_trigger() fails the resources requested via
irq_request_resources() are not released.

Add the missing release call into the error handling path.

Fixes: c1bacbae8192 ("genirq: Provide irq_request/release_resources chip callbacks")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/655538f5-cb20-a892-ff15-fbd2dd1fa4ec@gmail.com
kernel/irq/manage.c

index 070be980c37a57d91f86099d2be1b81db80176bc..425170d4439be5926a63ef9be50c71c1dd5878a9 100644 (file)
@@ -1312,8 +1312,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
                        ret = __irq_set_trigger(desc,
                                                new->flags & IRQF_TRIGGER_MASK);
 
-                       if (ret)
+                       if (ret) {
+                               irq_release_resources(desc);
                                goto out_mask;
+                       }
                }
 
                desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \