From: Michael Buesch <mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
To: linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
jbenc-AlSwsSmVLrQ@public.gmane.org
Subject: [PATCH] bcm43xx-d80211: protect tx_stat callback from uninitialized device
Date: Mon, 10 Apr 2006 02:25:00 +0200 [thread overview]
Message-ID: <200604100225.01548.mb@bu3sch.de> (raw)
diff --git a/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c b/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c
index 043a5cf..f0f4f78 100644
--- a/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c
@@ -4128,15 +4128,19 @@ static int bcm43xx_net_get_tx_stats(stru
{
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
unsigned long flags;
+ int err = -ENODEV;
bcm43xx_lock(bcm, flags);
- if (bcm43xx_using_pio(bcm))
- bcm43xx_pio_get_tx_stats(bcm, stats);
- else
- bcm43xx_dma_get_tx_stats(bcm, stats);
+ if (likely(bcm->initialized)) {
+ if (bcm43xx_using_pio(bcm))
+ bcm43xx_pio_get_tx_stats(bcm, stats);
+ else
+ bcm43xx_dma_get_tx_stats(bcm, stats);
+ err = 0;
+ }
bcm43xx_unlock(bcm, flags);
- return 0;
+ return err;
}
static int bcm43xx_net_get_stats(struct net_device *net_dev,
--
Greetings Michael.
reply other threads:[~2006-04-10 0:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200604100225.01548.mb@bu3sch.de \
--to=mb-fseuscv1ubazqb+pc5nmwq@public.gmane.org \
--cc=bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
--cc=jbenc-AlSwsSmVLrQ@public.gmane.org \
--cc=linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).