aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/netconsole.c7
-rw-r--r--net/core/netpoll.c20
2 files changed, 18 insertions, 9 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index bf58db29e2ed..e6e8a9797b6d 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -102,6 +102,8 @@ __setup("netconsole=", option_setup);
102 102
103static int init_netconsole(void) 103static int init_netconsole(void)
104{ 104{
105 int err;
106
105 if(strlen(config)) 107 if(strlen(config))
106 option_setup(config); 108 option_setup(config);
107 109
@@ -110,8 +112,9 @@ static int init_netconsole(void)
110 return 0; 112 return 0;
111 } 113 }
112 114
113 if(netpoll_setup(&np)) 115 err = netpoll_setup(&np);
114 return -EINVAL; 116 if (err)
117 return err;
115 118
116 register_console(&netconsole); 119 register_console(&netconsole);
117 printk(KERN_INFO "netconsole: network logging started\n"); 120 printk(KERN_INFO "netconsole: network logging started\n");
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) {