aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2013-03-04 15:16:20 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2013-04-02 19:03:34 -0400
commit73f460408ca9b6e917f32c89c9a85c586f17f732 (patch)
tree925c4d98b4a310b09cca9c0475a70e5a14224bb3 /arch/x86
parent1423bed239415edd1562c25be8a7408858fdbb19 (diff)
x86, quirks: Shut-up a long-standing gcc warning
So gcc nags about those since forever in randconfig builds. arch/x86/kernel/quirks.c: In function ‘ati_ixp4x0_rev’: arch/x86/kernel/quirks.c:361:4: warning: ‘b’ is used uninitialized in this function [-Wuninitialized] arch/x86/kernel/quirks.c: In function ‘ati_force_enable_hpet’: arch/x86/kernel/quirks.c:367:4: warning: ‘d’ may be used uninitialized in this function [-Wuninitialized] arch/x86/kernel/quirks.c:357:6: note: ‘d’ was declared here arch/x86/kernel/quirks.c:407:21: warning: ‘val’ may be used uninitialized in this function [-Wuninitialized] This function quirk is called on a SB400 chipset only anyway so the distant possibility of a PCI access failing becomes almost impossible there. Even if it did fail, then something else more serious is the problem. So zero-out the variables so that gcc shuts up but do a coarse check on the PCI accesses at the end and signal whether any of them had an error. They shouldn't but in case they do, we'll at least know and we can address it. Signed-off-by: Borislav Petkov <bp@suse.de> Link: http://lkml.kernel.org/r/1362428180-8865-6-git-send-email-bp@alien8.de Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/quirks.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 26ee48a33dc4..04ee1e2e4c02 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -354,18 +354,22 @@ static void ati_force_hpet_resume(void)
354 354
355static u32 ati_ixp4x0_rev(struct pci_dev *dev) 355static u32 ati_ixp4x0_rev(struct pci_dev *dev)
356{ 356{
357 u32 d; 357 int err = 0;
358 u8 b; 358 u32 d = 0;
359 u8 b = 0;
359 360
360 pci_read_config_byte(dev, 0xac, &b); 361 err = pci_read_config_byte(dev, 0xac, &b);
361 b &= ~(1<<5); 362 b &= ~(1<<5);
362 pci_write_config_byte(dev, 0xac, b); 363 err |= pci_write_config_byte(dev, 0xac, b);
363 pci_read_config_dword(dev, 0x70, &d); 364 err |= pci_read_config_dword(dev, 0x70, &d);
364 d |= 1<<8; 365 d |= 1<<8;
365 pci_write_config_dword(dev, 0x70, d); 366 err |= pci_write_config_dword(dev, 0x70, d);
366 pci_read_config_dword(dev, 0x8, &d); 367 err |= pci_read_config_dword(dev, 0x8, &d);
367 d &= 0xff; 368 d &= 0xff;
368 dev_printk(KERN_DEBUG, &dev->dev, "SB4X0 revision 0x%x\n", d); 369 dev_printk(KERN_DEBUG, &dev->dev, "SB4X0 revision 0x%x\n", d);
370
371 WARN_ON_ONCE(err);
372
369 return d; 373 return d;
370} 374}
371 375