Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1420618ybl; Sat, 10 Aug 2019 03:21:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqymElmYr+t+ZgZaZbUlDNGaVvBfQOoUAq2NpiYURJicHie25MaimKIFQiXOSwikzh2pnqg7 X-Received: by 2002:a17:902:2f:: with SMTP id 44mr23935548pla.5.1565432489279; Sat, 10 Aug 2019 03:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565432489; cv=none; d=google.com; s=arc-20160816; b=on2Yyabfkzjdc9eBunGbQiMS3Qb8uslN0/bPMNMrvmvHk//PB7cS2MGzHkdXSmz1ng k36dkoVcRzmFa+m1/EhhOwchg/6c6WwzEQdgJ29R0vz5NkAfilV/In/GGk3qDFkcNSXm KqJCxL/jQrk20wu4pQJTCa83oHABo7zxv5YXxYfgu7ITvUQES05sdmip9lRDKyB4ClNf NZu+4ZfpQkSyonPAG8NMMKmLcBMi3ByzBaRya6AA+2f7mJMPLKFo6ljdlkS3CM3bQZo1 LmFjP+3vO6Rdh790Y++xXoqrbIh4vjUBmcitZq/bX2/HwkdAyyOPnrkti9VyjCk0RpCs E1lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=G23YAqzI8T19HetQdcX7kjI4RG+fv1hWJdo2o5VB0xs=; b=0Jg/9GyXXoxaCDm501dNhk/ZmxJDmxifD56CeN3Az2f0ZcZuF2TjQKu6YRgx2r2i/7 2fd7ntN4pfxfKo4tk1vzb/G4nDgIPhgAtVfPnUzSwwN+iZLQeYcdYieyTjTBj6Wju5q8 4DKwI1nT2U/36dpvdzcp64AInqt0d4OUDPrlkwR4uyudQ/ARRXNKf1LamRsKT+P5mj6u Q8lUle//moskqnVPJebbioY2keV4qriS/ZvuwKLUElS2V+5nSPLCEF+YTiZocaw2Gdi0 Bwvp2ivhwPcCHn0zFyJomfO9UbElXlANVzYbPxbfe1u/rB3kW+N0YupM6uYvukIKS97o dpAQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y62si30203471pgy.348.2019.08.10.03.21.12; Sat, 10 Aug 2019 03:21:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726132AbfHJKUc (ORCPT + 99 others); Sat, 10 Aug 2019 06:20:32 -0400 Received: from ozlabs.org ([203.11.71.1]:36651 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbfHJKUb (ORCPT ); Sat, 10 Aug 2019 06:20:31 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id 465J5n2jRBz9sNC; Sat, 10 Aug 2019 20:20:29 +1000 (AEST) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: 0df3e42167caaf9f8c7b64de3da40a459979afe8 In-Reply-To: <20190603221157.58502-1-natechancellor@gmail.com> To: Nathan Chancellor , Tyrel Datwyler , Benjamin Herrenschmidt , Paul Mackerras From: Michael Ellerman Cc: linux-pci@vger.kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Bjorn Helgaas , Nathan Chancellor , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2] PCI: rpaphp: Avoid a sometimes-uninitialized warning Message-Id: <465J5n2jRBz9sNC@ozlabs.org> Date: Sat, 10 Aug 2019 20:20:29 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-06-03 at 22:11:58 UTC, 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 > Acked-by: Joel Savitz Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/0df3e42167caaf9f8c7b64de3da40a459979afe8 cheers