From patchwork Mon Dec 19 14:03:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9480303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD93C607D3 for ; Mon, 19 Dec 2016 14:04:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A21D128406 for ; Mon, 19 Dec 2016 14:04:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96299284E9; Mon, 19 Dec 2016 14:04:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C12F28487 for ; Mon, 19 Dec 2016 14:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753222AbcLSOEF (ORCPT ); Mon, 19 Dec 2016 09:04:05 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:33746 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932241AbcLSODl (ORCPT ); Mon, 19 Dec 2016 09:03:41 -0500 Received: from ayla.of.borg ([84.193.137.253]) by michel.telenet-ops.be with bizsmtp id Mq3e1u0045UCtCs06q3eGh; Mon, 19 Dec 2016 15:03:38 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1cIyXR-0002Hy-WF; Mon, 19 Dec 2016 15:03:38 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1cIyXa-0008TG-J1; Mon, 19 Dec 2016 15:03:46 +0100 From: Geert Uytterhoeven To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/2] mmc: block: Avoid uninitialized warning in mmc_blk_issue_discard_rq() Date: Mon, 19 Dec 2016 15:03:44 +0100 Message-Id: <1482156225-32517-1-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;