From patchwork Mon Jun 3 22:19:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10974033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22EFE14B6 for ; Mon, 3 Jun 2019 22:21:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 067BE28346 for ; Mon, 3 Jun 2019 22:21:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDF9828610; Mon, 3 Jun 2019 22:21:04 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 81BA328346 for ; Mon, 3 Jun 2019 22:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726566AbfFCWU7 (ORCPT ); Mon, 3 Jun 2019 18:20:59 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:42556 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfFCWU7 (ORCPT ); Mon, 3 Jun 2019 18:20:59 -0400 Received: by mail-ed1-f68.google.com with SMTP id z25so2965139edq.9; Mon, 03 Jun 2019 15:20:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6SwsUdnmJqsKjqmMv1ig0nFgLQISlIZ4mL0Bgh3d+ww=; b=rHbA+7ojNx2L8Y/O1X17tjfQ/ccJkMcflnR9LyPSByMs/+CaDM7588Ir9t9RCF6Tin lNZZwQ9Gf0eaxcIBJmjzcKt2W/7xPDdtLNk3lqUkdPFDIqLQfWYVNK1FRCS6m8izMj8o CR8zKd+dzcYJmoPDewqMUtr0ZbSeKyM9zcbLqCVtcX+d99RD0IWoF/R+GdWe40Jb+ghp 5EOciicMprv68Ht7k4mZyACACMbu85DqHslBZ5G3Oo68aNWaOSqAEOq69+ZZj5//eY+r LpdPgsxdma7p37jEdVF6X/XXb3au94zh2bUhNBDUHRdrMUmk0e4c3GsyikXDu4Bjt3eQ PDww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6SwsUdnmJqsKjqmMv1ig0nFgLQISlIZ4mL0Bgh3d+ww=; b=j3eIMRCrgDkGoAWQ8zUldsnwj55+6HcRqmJO5zs5ipr8avXK5OFFMd7uqodoooVE/Y Sq7ik0zpx+XuWAdAEDxvp+AdA46jaL0GBXvjqDxCKVtfrrV/FfcxYETnO/CHFN1qCwKC U394R4M5AGMo2iqtQYiwL2p2uaiJ1yAOVPqpqwS548+s5djDGELvGA3H1BdPWNBj72HD Wh76v71yG6O+vutQvTIECvFZkZVKgAivtVG0xNU1bh/dLJlPz/gxQjHZnWUM69rWpSJg fbfFhQMkKj3I4u5VPCACFPoaNnBFpkpEmL3OiCC6EGlDDiehmYY8QBMKNAuQHeZSuqWm /N2g== X-Gm-Message-State: APjAAAWM00YO1Y0WYy6B/WocBB35GiJRjYtkYFhsgwrmo/ZhSTlyrPVS pyTmr2HZ74nAnCQwSG83lLg= X-Google-Smtp-Source: APXvYqzntAHVC76B3HN+FQleN5MXwP0M+Bge4licIbThASXbaFHS9A4UtGAue+zV3RciZP5zzKQGDw== X-Received: by 2002:a50:a4f7:: with SMTP id x52mr31464852edb.86.1559600457550; Mon, 03 Jun 2019 15:20:57 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:2b:2b15::2]) by smtp.gmail.com with ESMTPSA id j9sm1515579ejm.68.2019.06.03.15.20.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 15:20:56 -0700 (PDT) From: Nathan Chancellor To: Tyrel Datwyler , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , Michael Ellerman Subject: [PATCH v2] scsi: ibmvscsi: Don't use rc uninitialized in ibmvscsi_do_work Date: Mon, 3 Jun 2019 15:19:42 -0700 Message-Id: <20190603221941.65432-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.22.0.rc3 In-Reply-To: <20190531185306.41290-1-natechancellor@gmail.com> References: <20190531185306.41290-1-natechancellor@gmail.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clang warns: drivers/scsi/ibmvscsi/ibmvscsi.c:2126:7: warning: variable 'rc' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] case IBMVSCSI_HOST_ACTION_NONE: ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/ibmvscsi/ibmvscsi.c:2151:6: note: uninitialized use occurs here if (rc) { ^~ Initialize rc to zero in the case statements that clang mentions so that the atomic_set and dev_err statement don't trigger for them. Fixes: 035a3c4046b5 ("scsi: ibmvscsi: redo driver work thread to use enum action states") Link: https://github.com/ClangBuiltLinux/linux/issues/502 Suggested-by: Michael Ellerman Signed-off-by: Nathan Chancellor Acked-by: Tyrel Datwyler --- v1 -> v2: * Initialize rc in the case statements, rather than at the top of the function, as suggested by Michael. drivers/scsi/ibmvscsi/ibmvscsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 65053daef5f7..3b5647d622d9 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -2109,9 +2109,6 @@ static void ibmvscsi_do_work(struct ibmvscsi_host_data *hostdata) spin_lock_irqsave(hostdata->host->host_lock, flags); switch (hostdata->action) { - case IBMVSCSI_HOST_ACTION_NONE: - case IBMVSCSI_HOST_ACTION_UNBLOCK: - break; case IBMVSCSI_HOST_ACTION_RESET: spin_unlock_irqrestore(hostdata->host->host_lock, flags); rc = ibmvscsi_reset_crq_queue(&hostdata->queue, hostdata); @@ -2128,7 +2125,10 @@ static void ibmvscsi_do_work(struct ibmvscsi_host_data *hostdata) if (!rc) rc = ibmvscsi_send_crq(hostdata, 0xC001000000000000LL, 0); break; + case IBMVSCSI_HOST_ACTION_NONE: + case IBMVSCSI_HOST_ACTION_UNBLOCK: default: + rc = 0; break; }