From: Ulf Hansson <ulf.hansson@stericsson.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Chris Ball <cjb@laptop.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH] mmc: fix card block compile warnings
Date: Thu, 22 Mar 2012 11:58:03 +0100 [thread overview]
Message-ID: <4F6B05BB.3080109@stericsson.com> (raw)
In-Reply-To: <1332401709-25513-1-git-send-email-linus.walleij@linaro.org>
On 03/22/2012 08:35 AM, Linus Walleij wrote:
> I'm pretty tired of seeing these in my kernel compiles:
> drivers/mmc/card/block.c: In function ‘mmc_blk_issue_secdiscard_rq’:
> drivers/mmc/card/block.c:911:18: warning: ‘arg’ may be used uninitialized in this function [-Wuninitialized]
> drivers/mmc/card/block.c:910:6: warning: ‘nr’ may be used uninitialized in this function [-Wuninitialized]
> drivers/mmc/card/block.c:910:6: warning: ‘from’ may be used uninitialized in this function [-Wuninitialized]
>
> This patch marks the variables explicitly uninitialized as
> seems to be the intention, I can assure myself they are not
> actually uninitialized at use time by just reading the code.
>
> Signed-off-by: Linus Walleij<linus.walleij@linaro.org>
> ---
> drivers/mmc/card/block.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index c6a383d..214ae68 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -874,7 +874,9 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
> {
> struct mmc_blk_data *md = mq->data;
> struct mmc_card *card = md->queue.card;
> - unsigned int from, nr, arg;
> + unsigned int uninitialized_var(from);
> + unsigned int uninitialized_var(nr);
> + unsigned int uninitialized_var(arg);
> int err = 0, type = MMC_BLK_SECDISCARD;
>
> if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) {
Is not the problem only related to the arg variable?
What about:
unsigned int from, nr, arg = 0;
Yours!
Ulf Hansson
next prev parent reply other threads:[~2012-03-22 10:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 7:35 [PATCH] mmc: fix card block compile warnings Linus Walleij
2012-03-22 10:58 ` Ulf Hansson [this message]
2012-03-22 18:02 ` Linus Walleij
2012-03-23 5:46 ` Rabin Vincent
2012-03-23 9:05 ` Linus Walleij
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=4F6B05BB.3080109@stericsson.com \
--to=ulf.hansson@stericsson.com \
--cc=cjb@laptop.org \
--cc=linus.walleij@linaro.org \
--cc=linux-mmc@vger.kernel.org \
/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