lkml.org 
[lkml]   [2015]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] manage/irq.c <misleading WARNING: Trying to free already-free IRQ>
From
Hello,

there is this WARNING coming "Trying to free already-free IRQ"
but that warning suggests that we are either calling free_irq twice
or
request_irq has not been made.


bu the problem was, free_irq was being called with invalid/NULL device id.
but the warning is misleading which does not hint to the invalid/NULL device id.

and this is not a shared interrupt, should not be some "meaningful
warning to be given" ??
also why to iterate through the list if it is not shared ?

patch below to address this.

(though I am still thinking if this is an optimal/good way to address it)
or even there is a need to address !

------------------------------------------------------------------------------
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3dc6a61..87a3ea0 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1305,6 +1305,7 @@ static struct irqaction *__free_irq(unsigned int
irq, void *dev_id)
struct irq_desc *desc = irq_to_desc(irq);
struct irqaction *action, **action_ptr;
unsigned long flags;
+ bool shared = false;

WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq);

@@ -1322,15 +1323,34 @@ static struct irqaction *__free_irq(unsigned
int irq, void *dev_id)
action = *action_ptr;

if (!action) {
- WARN(1, "Trying to free already-free IRQ %d\n", irq);
+ if (!shared) {
+ WARN(1, "Trying to free already-free
IRQ %d\n", irq);
+ raw_spin_unlock_irqrestore(&desc->lock, flags);
+
+ return NULL;
+ }
+ else {
+ WARN(1, "irq mismatch with device %d\n", irq);
+ raw_spin_unlock_irqrestore(&desc->lock, flags);
+
+ return NULL;
+ }
+ }
+
+ if (action->dev_id == dev_id)
+ break;
+
+ if (action->flags & IRQF_SHARED) {
+ action_ptr = &action->next;
+ shared = true;
+ }
+ else {
+ WARN(1, "irq mismatch with device %d\n", irq);
raw_spin_unlock_irqrestore(&desc->lock, flags);

return NULL;
}

- if (action->dev_id == dev_id)
- break;
- action_ptr = &action->next;
}

/* Found it - now remove it from the list of entries: */

\
 
 \ /
  Last update: 2015-11-01 13:01    [W:0.029 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site