| To: | jgarzik@xxxxxxxxx |
|---|---|
| Subject: | [patch 2.6.10-rc1 2/5] dscc4: code factorisation |
| From: | Francois Romieu <romieu@xxxxxxxxxxxxx> |
| Date: | Fri, 14 Jan 2005 01:10:54 +0100 |
| Cc: | netdev@xxxxxxxxxxx |
| In-reply-to: | <20050114000941.GA2219@xxxxxxxxxxxxxxxxxxxxxxxxxx> |
| References: | <20050114000732.GA28864@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20050114000941.GA2219@xxxxxxxxxxxxxxxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | Mutt/1.4.1i |
Small code factorization.
Signed-off-by: Francois Romieu <romieu@xxxxxxxxxxxxx>
diff -puN drivers/net/wan/dscc4.c~dscc4-010 drivers/net/wan/dscc4.c
--- linux-2.6.11-rc1/drivers/net/wan/dscc4.c~dscc4-010 2005-01-14
00:54:44.287823008 +0100
+++ linux-2.6.11-rc1-fr/drivers/net/wan/dscc4.c 2005-01-14 00:54:44.291822356
+0100
@@ -892,17 +892,14 @@ static int dscc4_found1(struct pci_dev *
for (i = 0; i < dev_per_card; i++) {
root[i].dev = alloc_hdlcdev(root + i);
- if (!root[i].dev) {
- while (i--)
- free_netdev(root[i].dev);
+ if (!root[i].dev)
goto err_free_dev;
- }
}
ppriv = (struct dscc4_pci_priv *) kmalloc(sizeof(*ppriv), GFP_KERNEL);
if (!ppriv) {
printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME);
- goto err_free_dev2;
+ goto err_free_dev;
}
memset(ppriv, 0, sizeof(struct dscc4_pci_priv));
@@ -958,15 +955,15 @@ static int dscc4_found1(struct pci_dev *
return ret;
err_unregister:
- while (--i >= 0) {
+ while (i-- > 0) {
dscc4_release_ring(root + i);
unregister_hdlc_device(dscc4_to_dev(&root[i]));
}
kfree(ppriv);
-err_free_dev2:
- for (i = 0; i < dev_per_card; i++)
- free_netdev(root[i].dev);
+ i = dev_per_card;
err_free_dev:
+ while (i-- > 0)
+ free_netdev(root[i].dev);
kfree(root);
err_out:
return ret;
_
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [patch 2.6.10-rc1 1/5] dscc4: use of uncompletely initialized struct, Francois Romieu |
|---|---|
| Next by Date: | [patch 2.6.10-rc1 3/5] dscc4: error status checking and pci janitoring, Francois Romieu |
| Previous by Thread: | [patch 2.6.10-rc1 1/5] dscc4: use of uncompletely initialized struct, Francois Romieu |
| Next by Thread: | [patch 2.6.10-rc1 3/5] dscc4: error status checking and pci janitoring, Francois Romieu |
| Indexes: | [Date] [Thread] [Top] [All Lists] |