From: Francois Romieu <romieu@fr.zoreil.com>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: Jeff Garzik <jgarzik@pobox.com>, netdev@vger.kernel.org
Subject: [PATCH 5/7] chelsio: useless test in cxgb2::remove_one
Date: Tue, 12 Dec 2006 00:21:22 +0100 [thread overview]
Message-ID: <20061211232122.GF8568@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <20061211231558.GA8568@electric-eye.fr.zoreil.com>
pci_get_drvadata() is necessarily distinct from NULL if
cxgb2::init_one succeeded. cxgb2::remove_one is solely
issued through the PCI device callback.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/chelsio/cxgb2.c | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 689b91c..c3b1648 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -1385,26 +1385,26 @@ static inline void t1_sw_reset(struct pc
static void __devexit remove_one(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
+ struct adapter *adapter = dev->priv;
+ int i;
- if (dev) {
- int i;
- struct adapter *adapter = dev->priv;
-
- for_each_port(adapter, i)
- if (test_bit(i, &adapter->registered_device_map))
- unregister_netdev(adapter->port[i].dev);
+ for_each_port(adapter, i) {
+ if (test_bit(i, &adapter->registered_device_map))
+ unregister_netdev(adapter->port[i].dev);
+ }
- t1_free_sw_modules(adapter);
- iounmap(adapter->regs);
- while (--i >= 0)
- if (adapter->port[i].dev)
- free_netdev(adapter->port[i].dev);
+ t1_free_sw_modules(adapter);
+ iounmap(adapter->regs);
- pci_release_regions(pdev);
- pci_disable_device(pdev);
- pci_set_drvdata(pdev, NULL);
- t1_sw_reset(pdev);
+ while (--i >= 0) {
+ if (adapter->port[i].dev)
+ free_netdev(adapter->port[i].dev);
}
+
+ pci_release_regions(pdev);
+ pci_disable_device(pdev);
+ pci_set_drvdata(pdev, NULL);
+ t1_sw_reset(pdev);
}
static struct pci_driver driver = {
--
1.4.2.3
next prev parent reply other threads:[~2006-12-11 23:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-11 23:15 [PATCH 0/7] chelsio: introduction Francois Romieu
2006-12-11 23:20 ` [PATCH 1/7] chelsio: move return, break and continue statements on their own line Francois Romieu
2006-12-11 23:20 ` [PATCH 2/7] chelsio: the return statement is not a function Francois Romieu
2006-12-11 23:21 ` [PATCH 3/7] chelsio: spaces, tabs and friends Francois Romieu
2006-12-11 23:21 ` [PATCH 4/7] chelsio: useless curly braces Francois Romieu
2006-12-11 23:21 ` Francois Romieu [this message]
2006-12-11 23:21 ` [PATCH 6/7] chelsio: misc cleanups in sge Francois Romieu
2006-12-11 23:21 ` [PATCH 7/7] chelsio: tabulate the update of the statistic counters Francois Romieu
2006-12-26 20:59 ` [PATCH 0/7] chelsio: introduction Jeff Garzik
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=20061211232122.GF8568@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.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).