Skip to contentSkip to conversation

bcm43xx: Add error checking in bcm43xx_sprom_write()

PATCH In review Larry Finger 2 participants 2 messages Nov 6, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcm43xx: Add error checking in bcm43xx_sprom_write()

From: Adrian Bunk <[email protected]>

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?

drivers/net/wireless/bcm43xx/bcm43xx_main.c +2 -2
Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
===================================================================
@@ -750,7 +750,7 @@ int bcm43xx_sprom_write(struct bcm43xx_p
 	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
@@ -772,7 +772,7 @@ int bcm43xx_sprom_write(struct bcm43xx_p
 		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);
#1 lore raw
Quoted 7 lines · Larry Finger

From: Adrian Bunk <[email protected]>

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?

Whoops, I thought I had fixed this bug long time ago. The patch is correct.

Quoted 2 lines
Quoted 23 lines

Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
===================================================================

drivers/net/wireless/bcm43xx/bcm43xx_main.c +2 -2
@@ -750,7 +750,7 @@ int bcm43xx_sprom_write(struct bcm43xx_p
 	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
@@ -772,7 +772,7 @@ int bcm43xx_sprom_write(struct bcm43xx_p
 		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);
Signature · 1 line
Greetings Michael.