aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-10-26 18:46:52 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:22:34 -0500
commitb41848b61bae30e3661efd4ec62ea380cedef687 (patch)
tree76d671dd1553be6f8355edbc344306f6d0d2ae72 /net/core
parentb6cd27ed33886a5ffaf0925a6d98e13e18e8a1af (diff)
netpoll setup error handling
The beast was not always healthy. When it was sick, it tended to be laconic and not tell anyone the real problem. A few small changes had it telling the world about its problems, if they really wanted to hear. Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/netpoll.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index ac4e8b8f57d1..621baa5da49f 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -611,20 +611,23 @@ int netpoll_setup(struct netpoll *np)
611 struct in_device *in_dev; 611 struct in_device *in_dev;
612 struct netpoll_info *npinfo; 612 struct netpoll_info *npinfo;
613 unsigned long flags; 613 unsigned long flags;
614 int err;
614 615
615 if (np->dev_name) 616 if (np->dev_name)
616 ndev = dev_get_by_name(np->dev_name); 617 ndev = dev_get_by_name(np->dev_name);
617 if (!ndev) { 618 if (!ndev) {
618 printk(KERN_ERR "%s: %s doesn't exist, aborting.\n", 619 printk(KERN_ERR "%s: %s doesn't exist, aborting.\n",
619 np->name, np->dev_name); 620 np->name, np->dev_name);
620 return -1; 621 return -ENODEV;
621 } 622 }
622 623
623 np->dev = ndev; 624 np->dev = ndev;
624 if (!ndev->npinfo) { 625 if (!ndev->npinfo) {
625 npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL); 626 npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL);
626 if (!npinfo) 627 if (!npinfo) {
628 err = -ENOMEM;
627 goto release; 629 goto release;
630 }
628 631
629 npinfo->rx_flags = 0; 632 npinfo->rx_flags = 0;
630 npinfo->rx_np = NULL; 633 npinfo->rx_np = NULL;
@@ -645,6 +648,7 @@ int netpoll_setup(struct netpoll *np)
645 if (!ndev->poll_controller) { 648 if (!ndev->poll_controller) {
646 printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n", 649 printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n",
647 np->name, np->dev_name); 650 np->name, np->dev_name);
651 err = -ENOTSUPP;
648 goto release; 652 goto release;
649 } 653 }
650 654
@@ -655,13 +659,14 @@ int netpoll_setup(struct netpoll *np)
655 np->name, np->dev_name); 659 np->name, np->dev_name);
656 660
657 rtnl_lock(); 661 rtnl_lock();
658 if (dev_change_flags(ndev, ndev->flags | IFF_UP) < 0) { 662 err = dev_open(ndev);
663 rtnl_unlock();
664
665 if (err) {
659 printk(KERN_ERR "%s: failed to open %s\n", 666 printk(KERN_ERR "%s: failed to open %s\n",
660 np->name, np->dev_name); 667 np->name, ndev->name);
661 rtnl_unlock();
662 goto release; 668 goto release;
663 } 669 }
664 rtnl_unlock();
665 670
666 atleast = jiffies + HZ/10; 671 atleast = jiffies + HZ/10;
667 atmost = jiffies + 4*HZ; 672 atmost = jiffies + 4*HZ;
@@ -699,6 +704,7 @@ int netpoll_setup(struct netpoll *np)
699 rcu_read_unlock(); 704 rcu_read_unlock();
700 printk(KERN_ERR "%s: no IP address for %s, aborting\n", 705 printk(KERN_ERR "%s: no IP address for %s, aborting\n",
701 np->name, np->dev_name); 706 np->name, np->dev_name);
707 err = -EDESTADDRREQ;
702 goto release; 708 goto release;
703 } 709 }
704 710
@@ -731,7 +737,7 @@ int netpoll_setup(struct netpoll *np)
731 kfree(npinfo); 737 kfree(npinfo);
732 np->dev = NULL; 738 np->dev = NULL;
733 dev_put(ndev); 739 dev_put(ndev);
734 return -1; 740 return err;
735} 741}
736 742
737static int __init netpoll_init(void) { 743static int __init netpoll_init(void) {