From: Li Hong on 9 Mar 2010 05:00 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(a)gmail.com> --- 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(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: [PATCH 7/7] xen: Enable event channel of PV extension of HVM Next: I Need Your Honesty. |