netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC: 2.6 patch] bcm43xx_sprom_write(): add error checks
@ 2006-11-06 14:21 Adrian Bunk
  2006-11-06 15:50 ` Larry Finger
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2006-11-06 14:21 UTC (permalink / raw)
  To: Larry.Finger, st3; +Cc: linville, netdev, linux-kernel

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@stusta.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;
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC: 2.6 patch] bcm43xx_sprom_write(): add error checks
  2006-11-06 14:21 [RFC: 2.6 patch] bcm43xx_sprom_write(): add error checks Adrian Bunk
@ 2006-11-06 15:50 ` Larry Finger
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Finger @ 2006-11-06 15:50 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linville, netdev, linux-kernel

Adrian Bunk wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-06 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06 14:21 [RFC: 2.6 patch] bcm43xx_sprom_write(): add error checks Adrian Bunk
2006-11-06 15:50 ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).