[PATCH] slip: Remove the unused code and add some cleanups inslip.c
From: Li Hong
Date: Tue Mar 09 2010 - 04:53:27 EST
In sl_alloc(), after the for block:
for (i = 0; i < slip_maxdev; i++) {
dev = slip_devs[i];
if (dev == NULL)
break;
}
The result is either i >= slip_maxdev or dev != NULL. So the following check
on dev is needless.
Signed-off-by: Li Hong <lihong.hi@xxxxxxxxx>
---
drivers/net/slip.c | 24 +++++++-----------------
1 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index ba5bbc5..adf89c0 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -737,24 +737,15 @@ static struct slip *sl_alloc(dev_t line)
if (i >= slip_maxdev)
return NULL;
- if (dev) {
- sl = netdev_priv(dev);
- if (test_bit(SLF_INUSE, &sl->flags)) {
- unregister_netdevice(dev);
- dev = NULL;
- slip_devs[i] = NULL;
- }
- }
+ char name[IFNAMSIZ];
+ sprintf(name, "sl%d", i);
- if (!dev) {
- char name[IFNAMSIZ];
- sprintf(name, "sl%d", i);
+ dev = alloc_netdev(sizeof(*sl), name, sl_setup);
+ if (!dev)
+ return NULL;
- dev = alloc_netdev(sizeof(*sl), name, sl_setup);
- if (!dev)
- return NULL;
- dev->base_addr = i;
- }
+ dev->base_addr = i;
+ slip_devs[i] = dev;
sl = netdev_priv(dev);
@@ -772,7 +763,6 @@ static struct slip *sl_alloc(dev_t line)
sl->outfill_timer.data = (unsigned long)sl;
sl->outfill_timer.function = sl_outfill;
#endif
- slip_devs[i] = dev;
return sl;
}
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/