Re: [PATCH] mmc: fix card block compile warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
  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

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


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux