[PATCH] mmc: block: Fix compile time warning for uninitalized variables

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

 



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

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.

 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))) {
-- 
1.7.4.1

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