[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <465J5n2jRBz9sNC@ozlabs.org>
Date: Sat, 10 Aug 2019 20:20:29 +1000 (AEST)
From: Michael Ellerman <patch-notifications@...erman.id.au>
To: Nathan Chancellor <natechancellor@...il.com>,
Tyrel Datwyler <tyreld@...ux.ibm.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>
Cc: linux-pci@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com,
Bjorn Helgaas <bhelgaas@...gle.com>,
Nathan Chancellor <natechancellor@...il.com>,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v2] PCI: rpaphp: Avoid a sometimes-uninitialized warning
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 <ndesaulniers@...gle.com>
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> Acked-by: Tyrel Datwyler <tyreld@...ux.ibm.com>
> Acked-by: Joel Savitz <jsavitz@...hat.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/0df3e42167caaf9f8c7b64de3da40a459979afe8
cheers
Powered by blists - more mailing lists