diff options
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/slcan.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 1b49df6b2470..aa8ad73477ba 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -473,12 +473,10 @@ static void slc_sync(void) | |||
473 | static struct slcan *slc_alloc(dev_t line) | 473 | static struct slcan *slc_alloc(dev_t line) |
474 | { | 474 | { |
475 | int i; | 475 | int i; |
476 | char name[IFNAMSIZ]; | ||
476 | struct net_device *dev = NULL; | 477 | struct net_device *dev = NULL; |
477 | struct slcan *sl; | 478 | struct slcan *sl; |
478 | 479 | ||
479 | if (slcan_devs == NULL) | ||
480 | return NULL; /* Master array missing ! */ | ||
481 | |||
482 | for (i = 0; i < maxdev; i++) { | 480 | for (i = 0; i < maxdev; i++) { |
483 | dev = slcan_devs[i]; | 481 | dev = slcan_devs[i]; |
484 | if (dev == NULL) | 482 | if (dev == NULL) |
@@ -490,25 +488,12 @@ static struct slcan *slc_alloc(dev_t line) | |||
490 | if (i >= maxdev) | 488 | if (i >= maxdev) |
491 | return NULL; | 489 | return NULL; |
492 | 490 | ||
493 | if (dev) { | 491 | sprintf(name, "slcan%d", i); |
494 | sl = netdev_priv(dev); | 492 | dev = alloc_netdev(sizeof(*sl), name, slc_setup); |
495 | if (test_bit(SLF_INUSE, &sl->flags)) { | 493 | if (!dev) |
496 | unregister_netdevice(dev); | 494 | return NULL; |
497 | dev = NULL; | ||
498 | slcan_devs[i] = NULL; | ||
499 | } | ||
500 | } | ||
501 | |||
502 | if (!dev) { | ||
503 | char name[IFNAMSIZ]; | ||
504 | sprintf(name, "slcan%d", i); | ||
505 | |||
506 | dev = alloc_netdev(sizeof(*sl), name, slc_setup); | ||
507 | if (!dev) | ||
508 | return NULL; | ||
509 | dev->base_addr = i; | ||
510 | } | ||
511 | 495 | ||
496 | dev->base_addr = i; | ||
512 | sl = netdev_priv(dev); | 497 | sl = netdev_priv(dev); |
513 | 498 | ||
514 | /* Initialize channel control data */ | 499 | /* Initialize channel control data */ |