Nathan Chancellor 0df3e42167 PCI: rpaphp: Avoid a sometimes-uninitialized warning
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.

Fixes: 2fcf3ae508c2 ("hotplug/drc-info: Add code to search ibm,drc-info property")
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Acked-by: Joel Savitz <jsavitz@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://github.com/ClangBuiltLinux/linux/issues/504
Link: https://lore.kernel.org/r/20190603221157.58502-1-natechancellor@gmail.com
2019-08-05 18:53:03 +10:00
..
2019-07-12 17:08:41 -05:00
2019-07-15 20:44:49 -07:00
2019-07-09 07:24:53 -05:00
2018-03-19 14:20:43 -05:00
2019-01-14 17:01:20 -06:00
2019-07-09 07:24:53 -05:00
2019-07-15 20:44:49 -07:00
2019-07-15 20:44:49 -07:00
2018-03-19 14:20:43 -05:00
2018-10-02 10:14:32 +02:00
2019-07-15 20:44:49 -07:00
2019-07-15 20:44:49 -07:00
2019-07-15 20:44:49 -07:00
2019-07-11 11:13:26 -05:00
2018-06-29 21:17:26 -05:00
2018-03-19 14:20:43 -05:00
2019-06-13 16:49:45 -05:00
2018-03-19 14:20:43 -05:00
2018-02-01 11:40:07 -06:00
2019-05-13 18:34:46 -05:00