mmc: block: Avoid uninitialized warning in mmc_blk_issue_discard_rq()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 19 Dec 2016 14:03:44 +0000 (15:03 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 13 Feb 2017 12:19:53 +0000 (13:19 +0100)
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>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/block.c

index cb1698f268f19023429df520713f20a3de6f6d25..5f942a34d65c668d20112eb670efb0cc5ebc2744 100644 (file)
@@ -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 @@ out:
                goto retry;
        if (!err)
                mmc_blk_reset_success(md, type);
+fail:
        blk_end_request(req, err, blk_rq_bytes(req));
 
        return err ? 0 : 1;