* mtd/maps/ceiva.c: possibly uninitialised local variable nr
@ 2010-02-01 10:26 d binderman
2010-02-09 11:47 ` Artem Bityutskiy
2010-02-25 12:50 ` David Woodhouse
0 siblings, 2 replies; 4+ messages in thread
From: d binderman @ 2010-02-01 10:26 UTC (permalink / raw)
To: dwmw2; +Cc: linux-mtd
Hello there,
I just ran the sourceforge tool cppcheck over the source code of the
new Linux kernel 2.6.33-rc6
It said
[./mtd/maps/ceiva.c:269]: (error) Uninitialized variable: nr
The source code is
static int __init clps_setup_flash(void)
{
int nr;
#ifdef CONFIG_ARCH_CEIVA
if (machine_is_ceiva()) {
info[0].base = CS0_PHYS_BASE;
info[0].size = SZ_32M;
info[0].width = CEIVA_FLASH_WIDTH;
info[1].base = CS1_PHYS_BASE;
info[1].size = SZ_32M;
info[1].width = CEIVA_FLASH_WIDTH;
nr = 2;
}
#endif
return nr;
}
There is no code to cope with the case that function machine_is_ceiva() returns 0
or that CONFIG_ARCH_CEIVA is undefined.
Suggest new belt'n'braces code
static int __init clps_setup_flash(void)
{
int nr = 0;
#ifdef CONFIG_ARCH_CEIVA
if (machine_is_ceiva()) {
info[0].base = CS0_PHYS_BASE;
info[0].size = SZ_32M;
info[0].width = CEIVA_FLASH_WIDTH;
info[1].base = CS1_PHYS_BASE;
info[1].size = SZ_32M;
info[1].width = CEIVA_FLASH_WIDTH;
nr = 2;
}
#endif
return nr;
}
Regards
David Binderman
_________________________________________________________________
Tell us your greatest, weirdest and funniest Hotmail stories
http://clk.atdmt.com/UKM/go/195013117/direct/01/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mtd/maps/ceiva.c: possibly uninitialised local variable nr
2010-02-01 10:26 mtd/maps/ceiva.c: possibly uninitialised local variable nr d binderman
@ 2010-02-09 11:47 ` Artem Bityutskiy
2010-02-25 12:50 ` David Woodhouse
1 sibling, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2010-02-09 11:47 UTC (permalink / raw)
To: d binderman; +Cc: linux-mtd, dwmw2
On Mon, 2010-02-01 at 10:26 +0000, d binderman wrote:
[snip]
> static int __init clps_setup_flash(void)
> {
> int nr = 0;
>
> #ifdef CONFIG_ARCH_CEIVA
> if (machine_is_ceiva()) {
> info[0].base = CS0_PHYS_BASE;
> info[0].size = SZ_32M;
> info[0].width = CEIVA_FLASH_WIDTH;
> info[1].base = CS1_PHYS_BASE;
> info[1].size = SZ_32M;
> info[1].width = CEIVA_FLASH_WIDTH;
> nr = 2;
> }
> #endif
> return nr;
> }
I've made a patch for this in my l2-mtd-2.6 / master, thanks. Here is
the URL, but it is not persistent:
http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/331d53a3eca96f7ae0a216aa9eb3addffccc9e6f
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mtd/maps/ceiva.c: possibly uninitialised local variable nr
2010-02-01 10:26 mtd/maps/ceiva.c: possibly uninitialised local variable nr d binderman
2010-02-09 11:47 ` Artem Bityutskiy
@ 2010-02-25 12:50 ` David Woodhouse
2010-02-25 13:25 ` Russell King
1 sibling, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2010-02-25 12:50 UTC (permalink / raw)
To: d binderman; +Cc: linux-mtd, rmk
On Mon, 2010-02-01 at 10:26 +0000, d binderman wrote:
> There is no code to cope with the case that function
> machine_is_ceiva() returns 0 or that CONFIG_ARCH_CEIVA is undefined.
CONFIG_ARCH_CEIVA can never be undefined -- this driver depends on
ARCH_CEIVA in Kconfig. I don't quite understand why it's littered with
the ifdefs. Russell?
The error you spot could conceivably happen in a multiplatform build
though (if such a build {is,becomes} possible for ARM platforms).
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mtd/maps/ceiva.c: possibly uninitialised local variable nr
2010-02-25 12:50 ` David Woodhouse
@ 2010-02-25 13:25 ` Russell King
0 siblings, 0 replies; 4+ messages in thread
From: Russell King @ 2010-02-25 13:25 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd, d binderman
On Thu, Feb 25, 2010 at 12:50:24PM +0000, David Woodhouse wrote:
> On Mon, 2010-02-01 at 10:26 +0000, d binderman wrote:
> > There is no code to cope with the case that function
> > machine_is_ceiva() returns 0 or that CONFIG_ARCH_CEIVA is undefined.
>
> CONFIG_ARCH_CEIVA can never be undefined -- this driver depends on
> ARCH_CEIVA in Kconfig. I don't quite understand why it's littered with
> the ifdefs. Russell?
Me neither. Better ask 'Rob Scott' who appears to be the person
who created this in the first place. Whether he's still interested
in it, or even doing Linux stuff I've no idea.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-25 13:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-01 10:26 mtd/maps/ceiva.c: possibly uninitialised local variable nr d binderman
2010-02-09 11:47 ` Artem Bityutskiy
2010-02-25 12:50 ` David Woodhouse
2010-02-25 13:25 ` Russell King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).