Patchwork [4/6] powerpc: Make virq_debug_show() cope with sparse irq_descs

login
register
mail settings
Submitter Michael Ellerman
Date Oct. 14, 2009, 5:44 a.m.
Message ID <a9e38f55dcc6487125ca1ab1f455b58d565fd397.1255499081.git.michael@ellerman.id.au>
Download mbox | patch
Permalink /patch/35917/
State Accepted, archived
Commit 76f1d94f3ebdee0d14cab4d87bdeed1cf9badb17
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Michael Ellerman - Oct. 14, 2009, 5:44 a.m.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/kernel/irq.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Grant Likely - Oct. 14, 2009, 6:34 p.m.
On Tue, Oct 13, 2009 at 11:44 PM, Michael Ellerman
<michael@ellerman.id.au> wrote:
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/powerpc/kernel/irq.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> index 6563221..baa49eb 100644
> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -1065,8 +1065,11 @@ static int virq_debug_show(struct seq_file *m, void *private)
>        seq_printf(m, "%-5s  %-7s  %-15s  %s\n", "virq", "hwirq",
>                      "chip name", "host name");
>
> -       for (i = 1; i < NR_IRQS; i++) {
> +       for (i = 1; i < nr_irqs; i++) {
>                desc = irq_to_desc(i);
> +               if (!desc)
> +                       continue;
> +
>                spin_lock_irqsave(&desc->lock, flags);
>
>                if (desc->action && desc->action->handler) {
> --
> 1.6.2.1
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>

Patch

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 6563221..baa49eb 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -1065,8 +1065,11 @@  static int virq_debug_show(struct seq_file *m, void *private)
 	seq_printf(m, "%-5s  %-7s  %-15s  %s\n", "virq", "hwirq",
 		      "chip name", "host name");
 
-	for (i = 1; i < NR_IRQS; i++) {
+	for (i = 1; i < nr_irqs; i++) {
 		desc = irq_to_desc(i);
+		if (!desc)
+			continue;
+
 		spin_lock_irqsave(&desc->lock, flags);
 
 		if (desc->action && desc->action->handler) {