* [PATCH] bcm43xx: Check error returns in initialization routines
@ 2007-01-19 4:06 Larry Finger
2007-01-22 18:11 ` Michael Buesch
0 siblings, 1 reply; 2+ messages in thread
From: Larry Finger @ 2007-01-19 4:06 UTC (permalink / raw)
To: John Linville
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w,
Michael Buesch
A number of the calls in the initialization routines fail to check the returned value for
errors. This patch adds the necessary checks and logs any errors found when appropriate.
Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
---
To be applied to wireless-2.6.
Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
===================================================================
--- wireless-2.6.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -2980,8 +2980,10 @@ static int bcm43xx_chipset_attach(struct
err = bcm43xx_pctl_set_crystal(bcm, 1);
if (err)
goto out;
- bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status);
- bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT);
+ err = bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status);
+ if (err)
+ goto out;
+ err = bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT);
out:
return err;
@@ -3793,12 +3795,18 @@ static int bcm43xx_attach_board(struct b
}
net_dev->base_addr = (unsigned long)bcm->mmio_addr;
- bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
+ err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
&bcm->board_vendor);
- bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID,
+ if (err)
+ goto err_iounmap;
+ err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID,
&bcm->board_type);
- bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID,
+ if (err)
+ goto err_iounmap;
+ err = bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID,
&bcm->board_revision);
+ if (err)
+ goto err_iounmap;
err = bcm43xx_chipset_attach(bcm);
if (err)
@@ -3889,6 +3897,7 @@ err_pci_release:
pci_release_regions(pci_dev);
err_pci_disable:
pci_disable_device(pci_dev);
+ printk(KERN_ERR PFX "Unable to attach board\n");
goto out;
}
---
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] bcm43xx: Check error returns in initialization routines
2007-01-19 4:06 [PATCH] bcm43xx: Check error returns in initialization routines Larry Finger
@ 2007-01-22 18:11 ` Michael Buesch
0 siblings, 0 replies; 2+ messages in thread
From: Michael Buesch @ 2007-01-22 18:11 UTC (permalink / raw)
To: Larry Finger; +Cc: John Linville, netdev, Bcm43xx-dev
On Friday 19 January 2007 05:06, Larry Finger wrote:
> A number of the calls in the initialization routines fail to check the returned value for
> errors. This patch adds the necessary checks and logs any errors found when appropriate.
ACK
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
>
> To be applied to wireless-2.6.
>
>
> Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> ===================================================================
> --- wireless-2.6.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> +++ wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> @@ -2980,8 +2980,10 @@ static int bcm43xx_chipset_attach(struct
> err = bcm43xx_pctl_set_crystal(bcm, 1);
> if (err)
> goto out;
> - bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status);
> - bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT);
> + err = bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status);
> + if (err)
> + goto out;
> + err = bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT);
>
> out:
> return err;
> @@ -3793,12 +3795,18 @@ static int bcm43xx_attach_board(struct b
> }
> net_dev->base_addr = (unsigned long)bcm->mmio_addr;
>
> - bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
> + err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
> &bcm->board_vendor);
> - bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID,
> + if (err)
> + goto err_iounmap;
> + err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID,
> &bcm->board_type);
> - bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID,
> + if (err)
> + goto err_iounmap;
> + err = bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID,
> &bcm->board_revision);
> + if (err)
> + goto err_iounmap;
>
> err = bcm43xx_chipset_attach(bcm);
> if (err)
> @@ -3889,6 +3897,7 @@ err_pci_release:
> pci_release_regions(pci_dev);
> err_pci_disable:
> pci_disable_device(pci_dev);
> + printk(KERN_ERR PFX "Unable to attach board\n");
> goto out;
> }
>
> ---
>
>
--
Greetings Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-22 18:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-19 4:06 [PATCH] bcm43xx: Check error returns in initialization routines Larry Finger
2007-01-22 18:11 ` Michael Buesch
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).