bcm43xx_sprom_write(): add error checks
Subsystems (3)
RFC PATCH 1/1 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 <[email protected]>
---
drivers/net/wireless/bcm43xx/bcm43xx_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/bcm43xx/bcm43xx_main.c renamed from drivers/net/wireless/bcm43xx/bcm43xx_main.c.old +2 -2
@@ -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 ; }
Quoted 3 lines · Adrian Bunk
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?
Exactly. This patch sent to wireless-2.6.
Thanks,
Larry