diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-08-13 23:14:58 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-21 13:57:22 -0700 |
commit | 2dc77533f1e495788d73ffa4bee4323b2646d2bb (patch) | |
tree | 8fbb76a90bf78ed0f2f02135ba523d8fb0ffca44 /lib | |
parent | 6170a506899aee3dd4934c928426505e47b1b466 (diff) | |
download | linux-2dc77533f1e495788d73ffa4bee4323b2646d2bb.tar.gz linux-2dc77533f1e495788d73ffa4bee4323b2646d2bb.tar.bz2 linux-2dc77533f1e495788d73ffa4bee4323b2646d2bb.zip |
sparc: kernel/pcic: silence gcc 7.x warning in pcibios_fixup_bus()
When building the kernel for Sparc using gcc 7.x, the build fails
with:
arch/sparc/kernel/pcic.c: In function ‘pcibios_fixup_bus’:
arch/sparc/kernel/pcic.c:647:8: error: ‘cmd’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cmd |= PCI_COMMAND_IO;
^~
The simplified code looks like this:
unsigned int cmd;
[...]
pcic_read_config(dev->bus, dev->devfn, PCI_COMMAND, 2, &cmd);
[...]
cmd |= PCI_COMMAND_IO;
I.e, the code assumes that pcic_read_config() will always initialize
cmd. But it's not the case. Looking at pcic_read_config(), if
bus->number is != 0 or if the size is not one of 1, 2 or 4, *val will
not be initialized.
As a simple fix, we initialize cmd to zero at the beginning of
pcibios_fixup_bus.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions