linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: block: Avoid uninitialized warning in mmc_blk_issue_discard_rq()
@ 2016-12-19 14:03 Geert Uytterhoeven
  2016-12-19 14:03 ` [PATCH 2/2] [RFC] mmc: block: Replace "goto retry" by a proper do / while loop Geert Uytterhoeven
  2016-12-29 19:02 ` [PATCH 1/2] mmc: block: Avoid uninitialized warning in mmc_blk_issue_discard_rq() Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2016-12-19 14:03 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, linux-kernel, Geert Uytterhoeven

With gcc-4.1.2:

    mmc/core/block.c: In function ‘mmc_blk_issue_discard_rq’:
    mmc/core/block.c:1150: warning: ‘arg’ may be used uninitialized in this function
    mmc/core/block.c:1150: warning: ‘nr’ may be used uninitialized in this function
    mmc/core/block.c:1150: warning: ‘from’ may be used uninitialized in this function

While this is a false positive, it can be avoided easily by jumping over
the checks for "err" that are always false.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/mmc/core/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index bab3f07b1117ea81..8c0e0833d481cf94 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1152,7 +1152,7 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
 
 	if (!mmc_can_erase(card)) {
 		err = -EOPNOTSUPP;
-		goto out;
+		goto fail;
 	}
 
 	from = blk_rq_pos(req);
@@ -1181,6 +1181,7 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
 		goto retry;
 	if (!err)
 		mmc_blk_reset_success(md, type);
+fail:
 	blk_end_request(req, err, blk_rq_bytes(req));
 
 	return err ? 0 : 1;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-29 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 14:03 [PATCH 1/2] mmc: block: Avoid uninitialized warning in mmc_blk_issue_discard_rq() Geert Uytterhoeven
2016-12-19 14:03 ` [PATCH 2/2] [RFC] mmc: block: Replace "goto retry" by a proper do / while loop Geert Uytterhoeven
2016-12-29 19:03   ` Ulf Hansson
2016-12-29 19:02 ` [PATCH 1/2] mmc: block: Avoid uninitialized warning in mmc_blk_issue_discard_rq() Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).