Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3883874ybi; Mon, 3 Jun 2019 01:48:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmqFYE+2P46m6zTkrYSQgmyfA9HYtMBIQRp5wbA4xmcQOTjsFpTmXi/FM7T9ItzB1SBm5L X-Received: by 2002:a62:fb0a:: with SMTP id x10mr6749232pfm.224.1559551704379; Mon, 03 Jun 2019 01:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559551704; cv=none; d=google.com; s=arc-20160816; b=Kz9H4FYeL6+Asm3jXc6EYN9lVgQlXcVHGQkl2B7adnhnTt7z9lKHbn0tJUAv+PMn8C 9Y9rdeCDeUMz8d94C9uM9SPCi/e4ShEA7zD/7GhsnsiPKPH0X1VRHtPlLnMM56IXK4ET RFEmLignVQC66PaNTIa247QrFTsCQFlgZPX1sJCSsI2oeYA3AGB4Z7MYlbEIhHddkhtT e+nEX4DV5sQWirtHfWL3oDASW2vCsNfN59tViPp7bUtqzMRGKXv7wwTLt34jWlBOxeRb 90TbpykHVGxAOY/d+5fg0ZRCQFMnFRn0pbq9Nt+4Howv8hcwZr45yAB/2N1kmoF154u0 yiYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=EIz0NOWAX/uobIhHG6/is2QasF1BW3QEbpzGLpjwL20=; b=vR+vXgG9ub1PexzNsyuggNX7rbuJw/3rQNDNMWzNwHqgR6poLzfbiA4l138j/uqNcH MssPCXXoSjfemXvM3DIcwRm8cF4jlqe+Mrqdm5GJO+0PxPvQzqE3wTAF2HlGyk6kQIXu 6kt5B4l8myrd+29OYRQqaQ7H0OwzjqI+TfjdM2vLDiwNa4SPwbJSKIwQlTYaGDmR/tVU AVJ4DtY5WUKq0fGPblxI2ULFM8fOjifNG2inDEoVm9xypLRM4hvvq8dD0Bw84UmGA8eY 4WeRRHe++tHf7Fk8VvzT7Jz9fp6eNxNO5knQberfG0ACiehQFkC/lH8ZmvoGDZ3QS2wo +mvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=WPHhyKe+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si18572249ple.81.2019.06.03.01.48.08; Mon, 03 Jun 2019 01:48:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=WPHhyKe+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727768AbfFCIp0 (ORCPT + 99 others); Mon, 3 Jun 2019 04:45:26 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:56791 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726653AbfFCIp0 (ORCPT ); Mon, 3 Jun 2019 04:45:26 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 45HTCL5n0hz9v0D9; Mon, 3 Jun 2019 10:45:18 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=WPHhyKe+; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id EQ8AzAKtaaNi; Mon, 3 Jun 2019 10:45:18 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 45HTCL4d8Zz9v0D6; Mon, 3 Jun 2019 10:45:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1559551518; bh=EIz0NOWAX/uobIhHG6/is2QasF1BW3QEbpzGLpjwL20=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=WPHhyKe+I1HWbWe98+E4FhOSpt26176vUn6v3/2lkFHz1L1LOr2Xmj8wZWUmsR+eC 3tVRjZfv5eBf/GrTrixBbDrhI47OrRfp2EBRUMapPoOGlfOTohOZeXLD8bvmkraJO3 3pl2dBzGIRRSLmUhQvogdilTN1N6QHLR58kQqz/8= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 555348B7B1; Mon, 3 Jun 2019 10:45:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id oJf0fEAn0lyt; Mon, 3 Jun 2019 10:45:23 +0200 (CEST) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id ECC778B7B8; Mon, 3 Jun 2019 10:45:22 +0200 (CEST) Subject: Re: [PATCH] scsi: ibmvscsi: Don't use rc uninitialized in ibmvscsi_do_work To: Nathan Chancellor , Tyrel Datwyler , "James E.J. Bottomley" , "Martin K. Petersen" Cc: clang-built-linux@googlegroups.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org References: <20190531185306.41290-1-natechancellor@gmail.com> From: Christophe Leroy Message-ID: Date: Mon, 3 Jun 2019 10:45:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190531185306.41290-1-natechancellor@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 31/05/2019 à 20:53, Nathan Chancellor a écrit : > 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 so that the atomic_set and dev_err statement don't > trigger for the cases that just break. > > Fixes: 035a3c4046b5 ("scsi: ibmvscsi: redo driver work thread to use enum action states") > Link: https://github.com/ClangBuiltLinux/linux/issues/502 > Signed-off-by: Nathan Chancellor > --- > drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c > index 727c31dc11a0..6714d8043e62 100644 > --- a/drivers/scsi/ibmvscsi/ibmvscsi.c > +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c > @@ -2118,7 +2118,7 @@ static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev) > static void ibmvscsi_do_work(struct ibmvscsi_host_data *hostdata) > { > unsigned long flags; > - int rc; > + int rc = 0; I don't think the above is the best solution, as it hides the warning instead of really fixing it. Your problem is that some legs of the switch are missing setting the value of rc, it would therefore be better to fix the legs instead of setting a default value which may not be correct for every case, allthough it may be at the time being. Christophe > char *action = "reset"; > > spin_lock_irqsave(hostdata->host->host_lock, flags); >