linux-stable/drivers/pci/hotplug
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: 2fcf3ae508 ("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
..
acpi_pcihp.c PCI: shpchp: Separate existence of SHPC and permission to use it 2018-06-26 15:38:28 -05:00
acpiphp.h Merge branch 'xarray' of git://git.infradead.org/users/willy/linux-dax 2018-10-28 11:35:40 -07:00
acpiphp_core.c Merge branch 'xarray' of git://git.infradead.org/users/willy/linux-dax 2018-10-28 11:35:40 -07:00
acpiphp_glue.c Update email address 2018-09-29 22:47:48 -04:00
acpiphp_ibm.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
cpci_hotplug.h PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
cpci_hotplug_core.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
cpci_hotplug_pci.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
cpcihp_generic.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpcihp_zt5550.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpcihp_zt5550.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpqphp.h PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
cpqphp_core.c PCI: cpqphp: Remove set but not used variable 'physical_slot' 2018-10-02 16:04:40 -05:00
cpqphp_ctrl.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
cpqphp_nvram.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpqphp_nvram.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpqphp_pci.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
cpqphp_sysfs.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
ibmphp.h PCI: ibmphp: Turn semaphores into completions or mutexes 2019-01-29 17:15:36 -06:00
ibmphp_core.c PCI: ibmphp: Turn semaphores into completions or mutexes 2019-01-29 17:15:36 -06:00
ibmphp_ebda.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
ibmphp_hpc.c PCI: ibmphp: Turn semaphores into completions or mutexes 2019-01-29 17:15:36 -06:00
ibmphp_pci.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
ibmphp_res.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
Kconfig PCI: shpchp: Convert SHPC to be builtin only 2018-06-02 00:18:28 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_hotplug_core.c PCI: hotplug: Drop hotplug_slot_info 2018-09-18 17:52:15 -05:00
pciehp.h PCI: pciehp: Remove pointless MY_NAME definition 2019-05-09 16:45:21 -05:00
pciehp_core.c PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition 2019-05-09 16:45:21 -05:00
pciehp_ctrl.c pci-v5.2-changes 2019-05-14 10:30:10 -07:00
pciehp_hpc.c PCI: pciehp: Remove pointless MY_NAME definition 2019-05-09 16:45:21 -05:00
pciehp_pci.c PCI: pciehp: Log messages with pci_dev, not pcie_device 2019-05-09 16:45:20 -05:00
pnv_php.c powerpc updates for 4.20 2018-10-26 14:36:21 -07:00
rpadlpar.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
rpadlpar_core.c PCI: rpadlpar: Fix leaked device_node references in add/remove paths 2019-04-10 16:07:12 -05:00
rpadlpar_sysfs.c pci-v4.16-changes 2018-02-06 09:59:40 -08:00
rpaphp.h PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
rpaphp_core.c PCI: rpaphp: Avoid a sometimes-uninitialized warning 2019-08-05 18:53:03 +10:00
rpaphp_pci.c PCI: hotplug: Drop hotplug_slot_info 2018-09-18 17:52:15 -05:00
rpaphp_slot.c PCI: rpaphp: Get/put device node reference during slot alloc/dealloc 2019-04-10 16:07:12 -05:00
s390_pci_hpc.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
sgi_hotplug.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
shpchp.h PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
shpchp_core.c PCI: hotplug: Embed hotplug_slot 2018-09-18 17:52:15 -05:00
shpchp_ctrl.c PCI: hotplug: Drop hotplug_slot_info 2018-09-18 17:52:15 -05:00
shpchp_hpc.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
shpchp_pci.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
shpchp_sysfs.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
TODO PCI: hotplug: Document TODOs 2018-09-18 17:52:15 -05:00