[PATCH] fix warning in arch/x86/kernel/scx200_32.c

From: Ingo Molnar
Date: Sat Oct 18 2008 - 11:37:39 EST


fix this warning:

arch/x86/kernel/scx200_32.c: In function âscx200_probeâ:
arch/x86/kernel/scx200_32.c:82: warning: âbaseâ may be used uninitialized in this function

gcc is right: pci_read_config_dword() can fail, and this code did not
handle it.

Add proper error handling.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
arch/x86/kernel/scx200_32.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/scx200_32.c b/arch/x86/kernel/scx200_32.c
index 7e004ac..1b6e3d1 100644
--- a/arch/x86/kernel/scx200_32.c
+++ b/arch/x86/kernel/scx200_32.c
@@ -78,8 +78,10 @@ static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_
if (scx200_cb_probe(SCx200_CB_BASE_FIXED)) {
scx200_cb_base = SCx200_CB_BASE_FIXED;
} else {
- pci_read_config_dword(pdev, SCx200_CBA_SCRATCH, &base);
- if (scx200_cb_probe(base)) {
+ int err;
+
+ err = pci_read_config_dword(pdev, SCx200_CBA_SCRATCH, &base);
+ if (!err && scx200_cb_probe(base)) {
scx200_cb_base = base;
} else {
printk(KERN_WARNING NAME ": Configuration Block not found\n");

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/