Thomas Petazzoni 2dc77533f1 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>
2017-08-21 13:57:22 -07:00
..
2017-06-01 09:42:46 -07:00
2017-03-28 18:24:00 -04:00
2016-11-18 11:16:59 -08:00
2017-06-06 16:41:47 -04:00
2017-06-12 15:44:03 -07:00
2016-12-11 18:01:51 -08:00
2017-03-27 21:51:40 -07:00
2017-06-25 22:01:11 -04:00
2017-03-27 21:51:40 -07:00
2017-03-27 21:51:40 -07:00
2017-04-23 18:28:55 -07:00
2017-04-23 18:28:55 -07:00
2017-06-15 08:25:19 -07:00
2017-06-25 22:01:11 -04:00
2017-06-06 13:45:29 -07:00
2017-03-27 21:51:40 -07:00
2017-03-27 21:51:40 -07:00