Skip to content

Commit 68581e9

Browse files
Mark Nelsonozbenh
authored andcommitted
powerpc/pseries: Add WARN_ON() to request_event_sources_irqs() on irq allocation/request failure
At the moment if request_event_sources_irqs() can't allocate or request the interrupt, it just does a KERN_ERR printk. This may be fine for the existing RAS code where if we miss an EPOW event it just means that the event won't be logged and if we miss one of the RAS errors then we could miss an event that we perhaps should take action on. But, for the upcoming IO events code that will use event-sources if we can't allocate or request the interrupt it means we'd potentially miss an interrupt from the device. So, let's add a WARN_ON() in this error case so that we're a bit more vocal when something's amiss. While we're at it, also use pr_err() to neaten the code up a bit. Signed-off-by: Mark Nelson <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent b08e281 commit 68581e9

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

arch/powerpc/platforms/pseries/event_sources.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ void request_event_sources_irqs(struct device_node *np,
4141
if (count > 15)
4242
break;
4343
virqs[count] = irq_create_mapping(NULL, *(opicprop++));
44-
if (virqs[count] == NO_IRQ)
45-
printk(KERN_ERR "Unable to allocate interrupt "
46-
"number for %s\n", np->full_name);
44+
if (virqs[count] == NO_IRQ) {
45+
pr_err("event-sources: Unable to allocate "
46+
"interrupt number for %s\n",
47+
np->full_name);
48+
WARN_ON(1);
49+
}
4750
else
4851
count++;
4952

@@ -59,9 +62,12 @@ void request_event_sources_irqs(struct device_node *np,
5962
virqs[count] = irq_create_of_mapping(oirq.controller,
6063
oirq.specifier,
6164
oirq.size);
62-
if (virqs[count] == NO_IRQ)
63-
printk(KERN_ERR "Unable to allocate interrupt "
64-
"number for %s\n", np->full_name);
65+
if (virqs[count] == NO_IRQ) {
66+
pr_err("event-sources: Unable to allocate "
67+
"interrupt number for %s\n",
68+
np->full_name);
69+
WARN_ON(1);
70+
}
6571
else
6672
count++;
6773
}
@@ -70,8 +76,9 @@ void request_event_sources_irqs(struct device_node *np,
7076
/* Now request them */
7177
for (i = 0; i < count; i++) {
7278
if (request_irq(virqs[i], handler, 0, name, NULL)) {
73-
printk(KERN_ERR "Unable to request interrupt %d for "
74-
"%s\n", virqs[i], np->full_name);
79+
pr_err("event-sources: Unable to request interrupt "
80+
"%d for %s\n", virqs[i], np->full_name);
81+
WARN_ON(1);
7582
return;
7683
}
7784
}

0 commit comments

Comments
 (0)