From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753262AbcL2TDA (ORCPT ); Thu, 29 Dec 2016 14:03:00 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37802 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752982AbcL2TC7 (ORCPT ); Thu, 29 Dec 2016 14:02:59 -0500 MIME-Version: 1.0 In-Reply-To: <1482156225-32517-1-git-send-email-geert@linux-m68k.org> References: <1482156225-32517-1-git-send-email-geert@linux-m68k.org> From: Ulf Hansson Date: Thu, 29 Dec 2016 20:02:51 +0100 Message-ID: Subject: Re: [PATCH 1/2] mmc: block: Avoid uninitialized warning in mmc_blk_issue_discard_rq() To: Geert Uytterhoeven Cc: "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uBTJ3BWI005600 On 19 December 2016 at 15:03, Geert Uytterhoeven wrote: > 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 Thanks, applied for next! Kind regards Uffe > --- > 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 >