linux/arch/sparc
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
..
boot sparc: Add "install" target 2014-08-04 20:45:59 -07:00
configs sparc: defconfig: Cleanup from old Kconfig options 2017-07-20 12:37:10 -07:00
crypto crypto: sparc - initialize blkcipher.ivsize 2015-10-08 21:36:48 +08:00
include mm: add pmd_t initializer __pmd() to work around a GCC bug. 2017-08-10 15:03:57 -07:00
kernel sparc: kernel/pcic: silence gcc 7.x warning in pcibios_fixup_bus() 2017-08-21 13:57:22 -07:00
lib sparc64: Don't clibber fixed registers in __multi4. 2017-08-16 10:59:54 -07:00
math-emu Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
mm sparc64: Increase max_phys_bits to 51 and VA bits to 53 for M8. 2017-08-04 11:08:53 -07:00
net bpf: Add jited_len to struct bpf_prog 2017-06-06 15:41:24 -04:00
oprofile
power sparc64: Prevent perf from running during super critical sections 2017-07-18 11:25:52 -07:00
prom sparc: fixing ident and beautifying code 2016-10-06 01:46:40 -04:00
Kbuild sparc64: Add SHA1 driver making use of the 'sha1' instruction. 2012-08-20 15:08:49 -07:00
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next 2017-07-08 12:14:14 -07:00
Kconfig.debug
Makefile sparc32: Add -Wa,-Av8 to KBUILD_CFLAGS. 2016-03-01 00:24:04 -05:00