Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4753513ybi; Mon, 3 Jun 2019 17:05:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyf9Q7SplZuoQAa2rkLtMXnAzu27ieECKUnk2dBlUL3SFWJuUcZ8NPreiK9w40Jao1nwxmn X-Received: by 2002:aa7:8145:: with SMTP id d5mr35313787pfn.11.1559606700989; Mon, 03 Jun 2019 17:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559606700; cv=none; d=google.com; s=arc-20160816; b=QLvzNfw33vCWkt7o0fvkqW8Jr+JR6/rO0jKh/QpqPH0CfnmxrHp3Id6lqbCEDm8MhK Jmo3yDG13JTanN5pX3YhYSOjp5DpysIEXJsLqBTLshWyFBeZJY5jOO6yz49RI5lZOtDZ 4NNeKtv+5Z34cFSAleTSildKbWfo4iQ1dVFKP5IZxJXq+NDK7HXimQT2UF2+y1OH8Gu7 0C2IQVHqA6eRM8+OOFb0R8cYXcCVFX03w201sg+gZvHRO3gcBGTdhm6PU7MNWte0E+3M GtZWjGqPP7DC3X7XmMxCPFBNFMWEqkoTnqCuhir+VecxK0hZ13ZB3EOpP2GhzoJQlg6E XaiQ== 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; bh=bPWPiWX2uLfR5IExGNA4NlLUYeCiNtxdjupSIbkmN34=; b=imj9kRh0HUviny3XzuHSVz98Q6ditxQhqD08JV8Ouy9oDRHoKECG/TlBXUqAClb3XE j4lTB/yRpKcytwWr1HypcXjzUMUXSDyQ/htsD9cqANjU5DOZ+Yn1I8eo3xQJwELan/FW z1QXGdjpsc3oI8wEQeUixVsQCIPsMjwUm7yRNtKdLyMIUfj/2zq8lEzuASNvz05rSRE8 cZAVaK4CYSRLz1JqoTMRNarGwoDkVD1z9hH3OfF48iGYk5TqdbMT4tlIcR6hAk2eYtYM DWmg75KfmFzVnbpz70rkzyIIHa3BPK1yDhQxk9nn/XmArDvu5F+YYmhH6AQTzQ5kTcsR FIGQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si24429919pfb.264.2019.06.03.17.04.45; Mon, 03 Jun 2019 17:05:00 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbfFDADm (ORCPT + 99 others); Mon, 3 Jun 2019 20:03:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42090 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726102AbfFDADm (ORCPT ); Mon, 3 Jun 2019 20:03:42 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x54024MF027585; Mon, 3 Jun 2019 20:03:15 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2swaajyhuk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 20:03:15 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x5403Dm1031622; Mon, 3 Jun 2019 20:03:14 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com with ESMTP id 2swaajyhsk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 20:03:14 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x53HmTGf010647; Mon, 3 Jun 2019 18:08:14 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma01dal.us.ibm.com with ESMTP id 2suh09413g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 18:08:14 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5403BbY18022734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 4 Jun 2019 00:03:11 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 471C2AC05F; Tue, 4 Jun 2019 00:03:11 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4EACAC065; Tue, 4 Jun 2019 00:03:09 +0000 (GMT) Received: from oc6857751186.ibm.com (unknown [9.85.191.102]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 4 Jun 2019 00:03:09 +0000 (GMT) Subject: Re: [PATCH v2] PCI: rpaphp: Avoid a sometimes-uninitialized warning To: Nathan Chancellor , Tyrel Datwyler , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers References: <20190603174323.48251-1-natechancellor@gmail.com> <20190603221157.58502-1-natechancellor@gmail.com> From: Tyrel Datwyler Message-ID: <78f5a331-6158-0ef5-0476-b976c8e71a68@linux.vnet.ibm.com> Date: Mon, 3 Jun 2019 17:03:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190603221157.58502-1-natechancellor@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-03_19:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906030160 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/03/2019 03:11 PM, Nathan Chancellor wrote: > When building with -Wsometimes-uninitialized, clang warns: > > drivers/pci/hotplug/rpaphp_core.c:243:14: warning: variable 'fndit' is > used uninitialized whenever 'for' loop exits because its condition is > false [-Wsometimes-uninitialized] > for (j = 0; j < entries; j++) { > ^~~~~~~~~~~ > drivers/pci/hotplug/rpaphp_core.c:256:6: note: uninitialized use occurs > here > if (fndit) > ^~~~~ > drivers/pci/hotplug/rpaphp_core.c:243:14: note: remove the condition if > it is always true > for (j = 0; j < entries; j++) { > ^~~~~~~~~~~ > drivers/pci/hotplug/rpaphp_core.c:233:14: note: initialize the variable > 'fndit' to silence this warning > int j, fndit; > ^ > = 0 > > fndit is only used to gate a sprintf call, which can be moved into the > loop to simplify the code and eliminate the local variable, which will > fix this warning. > > Link: https://github.com/ClangBuiltLinux/linux/issues/504 > Fixes: 2fcf3ae508c2 ("hotplug/drc-info: Add code to search ibm,drc-info property") > Suggested-by: Nick Desaulniers > Signed-off-by: Nathan Chancellor Acked-by: Tyrel Datwyler