[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061106142146.GN5778@stusta.de>
Date: Mon, 6 Nov 2006 15:21:46 +0100
From: Adrian Bunk <bunk@...sta.de>
To: Larry.Finger@...inger.net, st3@...eup.net
Cc: linville@...driver.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC: 2.6 patch] bcm43xx_sprom_write(): add error checks
The Coverity checker noted that these "if (err)"'s couldn't ever be
true.
It seems the intention was to check the return values of the
bcm43xx_pci_write_config32()'s?
Signed-off-by: Adrian Bunk <bunk@...sta.de>
---
drivers/net/wireless/bcm43xx/bcm43xx_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c.old 2006-11-06 14:45:47.000000000 +0100
+++ linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c 2006-11-06 14:46:53.000000000 +0100
@@ -737,47 +737,47 @@ int bcm43xx_sprom_write(struct bcm43xx_p
crc = bcm43xx_sprom_crc(sprom);
expected_crc = (sprom[BCM43xx_SPROM_VERSION] & 0xFF00) >> 8;
if (crc != expected_crc) {
printk(KERN_ERR PFX "SPROM input data: Invalid CRC\n");
return -EINVAL;
}
printk(KERN_INFO PFX "Writing SPROM. Do NOT turn off the power! Please stand by...\n");
err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCICFG_SPROMCTL, &spromctl);
if (err)
goto err_ctlreg;
spromctl |= 0x10; /* SPROM WRITE enable. */
- bcm43xx_pci_write_config32(bcm, BCM43xx_PCICFG_SPROMCTL, spromctl);
+ err = bcm43xx_pci_write_config32(bcm, BCM43xx_PCICFG_SPROMCTL, spromctl);
if (err)
goto err_ctlreg;
/* We must burn lots of CPU cycles here, but that does not
* really matter as one does not write the SPROM every other minute...
*/
printk(KERN_INFO PFX "[ 0%%");
mdelay(500);
for (i = 0; i < BCM43xx_SPROM_SIZE; i++) {
if (i == 16)
printk("25%%");
else if (i == 32)
printk("50%%");
else if (i == 48)
printk("75%%");
else if (i % 2)
printk(".");
bcm43xx_write16(bcm, BCM43xx_SPROM_BASE + (i * 2), sprom[i]);
mmiowb();
mdelay(20);
}
spromctl &= ~0x10; /* SPROM WRITE enable. */
- bcm43xx_pci_write_config32(bcm, BCM43xx_PCICFG_SPROMCTL, spromctl);
+ err = bcm43xx_pci_write_config32(bcm, BCM43xx_PCICFG_SPROMCTL, spromctl);
if (err)
goto err_ctlreg;
mdelay(500);
printk("100%% ]\n");
printk(KERN_INFO PFX "SPROM written.\n");
bcm43xx_controller_restart(bcm, "SPROM update");
return 0;
err_ctlreg:
printk(KERN_ERR PFX "Could not access SPROM control register.\n");
return -ENODEV;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists