From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] arch/arm/lib/board.c - uninitialized vars
Date: Thu, 06 Nov 2014 12:28:41 +0100 [thread overview]
Message-ID: <20141106112841.78173382347@gemini.denx.de> (raw)
Hi,
I'm trying to clean up some warnings/errors detected when running
"cppcheck" on the U-Boot source tree. For arch/arm/lib/board.c
I get this:
[arch/arm/lib/board.c:445]: (error) Uninitialized variable: id
[arch/arm/lib/board.c:422]: (error) Uninitialized variable: addr_sp
The problem is not usually detected by GCC depending on which macros
are active, here especially CONFIG_SPL_BUILD
The relevant code was last touched / introduced by commit f1d2b313:
"ARM: add relocation support" some two years ago...
I have some questions regarding the CONFIG_SPL_BUILD "else" case
(i. e. when building with CONFIG_SPL_BUILD defined):
422 addr_sp += 128; /* leave 32 words for abort-stack */
Is this correct? The stack is growing downward, so should the '+' not
be replaced by a '-', like we do a few lines above:
412 /* leave 3 words for abort-stack */
413 addr_sp -= 12;
Why do we need 128 words in the CONFIG_SPL_BUILD case, but only 3
otherwise?
Should we not move the "alignment for ABI compliance" part outside the
CONFIG_SPL_BUILD if/else case, i. e. should this not always be done?
And of course, how should we correctly initialize the "id" and
"addr_sp" variable in both cases?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Der Dativ ist dem Genitiv sein Tod.
next reply other threads:[~2014-11-06 11:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 11:28 Wolfgang Denk [this message]
2014-11-06 12:10 ` [U-Boot] arch/arm/lib/board.c - uninitialized vars Heiko Schocher
2014-11-06 12:47 ` Wolfgang Denk
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=20141106112841.78173382347@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/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