Patchwork sparc: refactor code in fault_32.c

login
register
mail settings
Submitter Sam Ravnborg
Date Jan. 6, 2009, 8:52 p.m.
Message ID <20090106205209.GA24034@uranus.ravnborg.org>
Download mbox | patch
Permalink /patch/16851/
State Accepted
Delegated to: David Miller
Headers show

Comments

Sam Ravnborg - Jan. 6, 2009, 8:52 p.m.
The sparc allmodconfig build broke due to enabling of the
branch_tracer that does some very clever things with
all if conditions. This caused my gcc 3.4.5 to be so confused that
it emitted a warning:

arch/sparc/mm/fault_32.c: In function `do_sparc_fault':
arch/sparc/mm/fault_32.c:176: warning: 'fixup' might be used uninitialized in this function

And with -Werror this broke the build.

Refactor code so it:
1) becomes more readable
2) no longer emit a warning with the branch_tracer enabled

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 6, 2009, 8:52 p.m.
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 6 Jan 2009 21:52:09 +0100

> The sparc allmodconfig build broke due to enabling of the
> branch_tracer that does some very clever things with
> all if conditions. This caused my gcc 3.4.5 to be so confused that
> it emitted a warning:
> 
> arch/sparc/mm/fault_32.c: In function `do_sparc_fault':
> arch/sparc/mm/fault_32.c:176: warning: 'fixup' might be used uninitialized in this function
> 
> And with -Werror this broke the build.
> 
> Refactor code so it:
> 1) becomes more readable
> 2) no longer emit a warning with the branch_tracer enabled
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Applied, thanks Sam.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg - Jan. 6, 2009, 9:06 p.m.
On Tue, Jan 06, 2009 at 12:52:49PM -0800, David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Tue, 6 Jan 2009 21:52:09 +0100
> 
> > The sparc allmodconfig build broke due to enabling of the
> > branch_tracer that does some very clever things with
> > all if conditions. This caused my gcc 3.4.5 to be so confused that
> > it emitted a warning:
> > 
> > arch/sparc/mm/fault_32.c: In function `do_sparc_fault':
> > arch/sparc/mm/fault_32.c:176: warning: 'fixup' might be used uninitialized in this function
> > 
> > And with -Werror this broke the build.
> > 
> > Refactor code so it:
> > 1) becomes more readable
> > 2) no longer emit a warning with the branch_tracer enabled
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> 
> Applied, thanks Sam.

It looks like this was the only one needed to build
sparc32 vmlinux with allmodconfig.
Still building but all sparc specific bits are built.

So outstanding issues now are:

1) How to fix "warning" in unaligned_64.c (get_user() || get_user())
2) Fix build of sparc32 vmlinux with the new stripping patches

I will try to give 2) a shot tomorrow - too late here now.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index a507e11..12e447f 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -283,7 +283,8 @@  bad_area_nosemaphore:
 	/* Is this in ex_table? */
 no_context:
 	g2 = regs->u_regs[UREG_G2];
-	if (!from_user && (fixup = search_extables_range(regs->pc, &g2))) {
+	if (!from_user) {
+		fixup = search_extables_range(regs->pc, &g2);
 		if (fixup > 10) { /* Values below are reserved for other things */
 			extern const unsigned __memset_start[];
 			extern const unsigned __memset_end[];