From: Adrian Hunter <adrian.hunter@intel.com>
To: Tushar Behera <tushar.behera@linaro.org>
Cc: linux-mmc@vger.kernel.org, cjb@laptop.org,
kyungmin.park@samsung.com, Jaehoon Chung <jh80.chung@samsung.com>
Subject: Re: [PATCH] mmc: block: Fix compile time warning for uninitalized variables
Date: Fri, 25 Nov 2011 12:06:49 +0200 [thread overview]
Message-ID: <4ECF68B9.7050708@intel.com> (raw)
In-Reply-To: <1322043102-28050-1-git-send-email-tushar.behera@linaro.org>
On 23/11/11 12:11, Tushar Behera wrote:
> This patch fixes following compile time warnings.
>
> drivers/mmc/card/block.c: In function ‘mmc_blk_issue_rq’:
> drivers/mmc/card/block.c:828:18: warning: ‘arg’ may be used uninitialized in this function [-Wun initialized]
> drivers/mmc/card/block.c:794:25: note: ‘arg’ was declared here
> drivers/mmc/card/block.c:827:6: warning: ‘nr’ may be used uninitialized in this function [-Wunin itialized]
> drivers/mmc/card/block.c:794:21: note: ‘nr’ was declared here
> drivers/mmc/card/block.c:827:6: warning: ‘from’ may be used uninitialized in this function [-Wun initialized]
> drivers/mmc/card/block.c:794:15: note: ‘from’ was declared here
>
> If the code follows the labels 'out' and 'retry', then we get
> to situation when these variables are used uninitialized.
>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>
> The patch is rebased on v3.2-rc2.
>
> I don't have much idea on what should be the default value
> for these variables. The fixes are provided just to do away
> with the compile time warnings.
It is a "goto" that is wrong, not the initialization.
But there is another problem. The sanitize code is
side-stepping the reset and retry path entirely.
>
> drivers/mmc/card/block.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index a1cb21f..8e0ffe9 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -791,7 +791,7 @@ 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 from = 0, nr = 0, arg = 0;
> int err = 0, type = MMC_BLK_SECDISCARD;
>
> if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) {
prev parent reply other threads:[~2011-11-25 10:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 10:11 [PATCH] mmc: block: Fix compile time warning for uninitalized variables Tushar Behera
2011-11-25 10:06 ` Adrian Hunter [this message]
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=4ECF68B9.7050708@intel.com \
--to=adrian.hunter@intel.com \
--cc=cjb@laptop.org \
--cc=jh80.chung@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-mmc@vger.kernel.org \
--cc=tushar.behera@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.