Skip to content

Commit

Permalink
Fix CONFIG_DEBUG_SHIRQ trigger on free_irq()
Browse files Browse the repository at this point in the history
Andy Gospodarek pointed out that because we return in the middle of the
free_irq() function, we never actually do call the IRQ handler that just
got deregistered. This should fix it, although I expect Andrew will want
to convert those 'return's to 'break'. That's a separate change though.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: Fernando Luis Vzquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Woodhouse authored and Linus Torvalds committed Oct 17, 2007
1 parent f13ef77 commit 1d99493
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ void free_irq(unsigned int irq, void *dev_id)
struct irq_desc *desc;
struct irqaction **p;
unsigned long flags;
irqreturn_t (*handler)(int, void *) = NULL;

WARN_ON(in_interrupt());
if (irq >= NR_IRQS)
Expand Down Expand Up @@ -445,28 +444,28 @@ void free_irq(unsigned int irq, void *dev_id)

/* Make sure it's not being used on another CPU */
synchronize_irq(irq);
if (action->flags & IRQF_SHARED)
handler = action->handler;
#ifdef CONFIG_DEBUG_SHIRQ
/*
* It's a shared IRQ -- the driver ought to be
* prepared for it to happen even now it's
* being freed, so let's make sure.... We do
* this after actually deregistering it, to
* make sure that a 'real' IRQ doesn't run in
* parallel with our fake
*/
if (action->flags & IRQF_SHARED) {
local_irq_save(flags);
action->handler(irq, dev_id);
local_irq_restore(flags);
}
#endif
kfree(action);
return;
}
printk(KERN_ERR "Trying to free already-free IRQ %d\n", irq);
spin_unlock_irqrestore(&desc->lock, flags);
return;
}
#ifdef CONFIG_DEBUG_SHIRQ
if (handler) {
/*
* It's a shared IRQ -- the driver ought to be prepared for it
* to happen even now it's being freed, so let's make sure....
* We do this after actually deregistering it, to make sure that
* a 'real' IRQ doesn't run in parallel with our fake
*/
local_irq_save(flags);
handler(irq, dev_id);
local_irq_restore(flags);
}
#endif
}
EXPORT_SYMBOL(free_irq);

Expand Down

0 comments on commit 1d99493

Please sign in to comment.