public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Nilsson <Jesper.Nilsson@axis.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Mikael Starvik <mikael.starvik@axis.com>,
	Martin Ettl <ettl.martin@gmx.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Fw: [Bugme-new] [Bug 13476] New: wrong #endif
Date: Wed, 10 Jun 2009 12:35:42 +0200	[thread overview]
Message-ID: <20090610103541.GL20504@axis.com> (raw)
In-Reply-To: <20090609141739.c922705e.akpm@linux-foundation.org>

On Tue, Jun 09, 2009 at 11:17:39PM +0200, Andrew Morton wrote:
> Begin forwarded message:
> 
> Date: Sun, 7 Jun 2009 14:02:50 GMT
> From: bugzilla-daemon@bugzilla.kernel.org
> To: bugme-new@lists.osdl.org
> Subject: [Bugme-new] [Bug 13476] New: wrong #endif
> 
> 
> http://bugzilla.kernel.org/show_bug.cgi?id=13476
> 
>            Summary: wrong #endif
>            Product: Other
>            Version: 2.5
>     Kernel Version: 2.6.29.4
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Other
>         AssignedTo: other_other@kernel-bugs.osdl.org
>         ReportedBy: ettl.martin@gmx.de
>         Regression: No
> 
> 
> Hello,
> 
> i've detected a wrong #ifdef ...#endif sequence. This was detected by cppcheck,
> a static code analysis tool.
> 
> At file :
> linux-2.6.29.4/arch/cris/arch-v32/kernel/irq.c
> 
> Take a look at the code, to function 
> void crisv32_do_multiple(struct pt_regs* regs)
> {
>     int cpu;
>     int mask;
>     int masked[NBR_REGS];
>     int bit;
>     int i;
> 
>     cpu = smp_processor_id();
> 
>     /* An extra irq_enter here to prevent softIRQs to run after
>          * each do_IRQ. This will decrease the interrupt latency.
>      */
>     irq_enter();
> 
>     for (i = 0; i < NBR_REGS; i++) {
>         /* Get which IRQs that happend. */
>         masked[i] = REG_RD_INT_VECT(intr_vect, irq_regs[cpu],
>             r_masked_vect, i);
> 
>         /* Calculate new IRQ mask with these IRQs disabled. */
>         mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, i);
>         mask &= ~masked[i];
> 
>     /* Timer IRQ is never masked */
> #ifdef TIMER_VECT1
>         if ((i == 1) && (masked[0] & TIMER_MASK))
>             mask |= TIMER_MASK;
> #else
>         if ((i == 0) && (masked[0] & TIMER_MASK))
>             mask |= TIMER_MASK;
> #endif
>         /* Block all the IRQs */
>         REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, i, mask);
> 
>     /* Check for timer IRQ and handle it special. */
> #ifdef TIMER_VECT1
>         if ((i == 1) && (masked[i] & TIMER_MASK)) {
>             masked[i] &= ~TIMER_MASK;
>             do_IRQ(TIMER0_INTR_VECT, regs);
>         }
> #else
>         if ((i == 0) && (masked[i] & TIMER_MASK)) {
>              masked[i] &= ~TIMER_MASK;
>              do_IRQ(TIMER0_INTR_VECT, regs);
>         }
>     }
> #endif
> 
> .....
> 
> Here, the last #endif is at the wrong place. It has to be before the bracket is
> closed. This is the corrected version:
> 
> #ifdef TIMER_VECT1
>         if ((i == 1) && (masked[i] & TIMER_MASK)) {
>             masked[i] &= ~TIMER_MASK;
>             do_IRQ(TIMER0_INTR_VECT, regs);
>         }
> #else
>         if ((i == 0) && (masked[i] & TIMER_MASK)) {
>              masked[i] &= ~TIMER_MASK;
>              do_IRQ(TIMER0_INTR_VECT, regs);
>         }
> #endif
>     }
> 
> 
> Best regards
> 
> Martin Ettl
> 
> -- 
> Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.

I'm unsure how to handle sign-off-by in this case, but I've queued the
following for the CRIS tree:

Subject: [PATCH] CRISv32: irq.c - Move end brace outside #endif

The end brace for a larger for statement was placed inside the #else
part of #ifdef TIMER_VECT1. However, for all current chips, the
define TIMER_VECT1 is always unset, and the error was never triggered.

Move the brace down below the #endif.

Fixes:
http://bugzilla.kernel.org/show_bug.cgi?id=13476

Reported-by: Martin Ettl <ettl.martin@gmx.de>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Mikael Starvik <mikael.starvik@axis.com>
---
 arch/cris/arch-v32/kernel/irq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index df3925c..9c9eb5b 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -428,8 +428,8 @@ crisv32_do_multiple(struct pt_regs* regs)
 			 masked[i] &= ~TIMER_MASK;
 			 do_IRQ(TIMER0_INTR_VECT, regs);
 		}
-	}
 #endif
+	}
 
 #ifdef IGNORE_MASK
 	/* Remove IRQs that can't be handled as multiple. */
-- 
1.6.1


Unless anyone have objections I'll push this to the cris for-next branch
in a day or two.

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

           reply	other threads:[~2009-06-10 10:36 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20090609141739.c922705e.akpm@linux-foundation.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090610103541.GL20504@axis.com \
    --to=jesper.nilsson@axis.com \
    --cc=akpm@linux-foundation.org \
    --cc=ettl.martin@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikael.starvik@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox