New: unregister_netdev() should return unregister_netdevice() return code
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · On Mon, 18 Dec 2006 14:56:31 -0800 [email protected] wrote:
http://bugzilla.kernel.org/show_bug.cgi?id=7708
Summary:
unregister_netdev()should returnunregister_netdevice()
return code
Kernel Version: 2.6.19.1
Status: NEW
Severity: low
Owner: [email protected]
Submitter: [email protected]
Quoted 6 lines
net/core/dev.c:unregister_netdev() function is a wrapper around net/core/dev.c:unregister_netdevice(). The
unregister_netdevice()function returns a return code whileunregister_netdev()currently does not. For completeness, we should pass the return code fromunregister_netdevice()all the way to the caller.unregister_netdev()should not swallow the return code.
Certainly there's some truth in that ;)
Is there some reason why you want to test the unregister_netdev() return value?
Quoted 21 lines · On Mon, 18 Dec 2006 15:21:11 -0800 Andrew Morton <[email protected]> wrote:
Quoted 11 lines · On Mon, 18 Dec 2006 14:56:31 -0800 [email protected] wrote:
http://bugzilla.kernel.org/show_bug.cgi?id=7708
Summary:
unregister_netdev()should returnunregister_netdevice()
return code
Kernel Version: 2.6.19.1
Status: NEW
Severity: low
Owner: [email protected]
Submitter: [email protected]Quoted 6 lines
net/core/dev.c:unregister_netdev() function is a wrapper around net/core/dev.c:unregister_netdevice(). The
unregister_netdevice()function returns a return code whileunregister_netdev()currently does not. For completeness, we should pass the return code fromunregister_netdevice()all the way to the caller.unregister_netdev()should not swallow the return code.
Quoted 4 lines
Certainly there's some truth in that ;)
Is there some reason why you want to test the
unregister_netdev()return value?
The only return value is -ENODEV, so I would vote for both just being void
Signature · 1 line
Stephen Hemminger <[email protected]>
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Mon, 18 Dec 2006 15:50:57 -0800
Quoted 10 lines
Quoted 7 lines · On Mon, 18 Dec 2006 15:21:11 -0800 Andrew Morton <[email protected]> wrote:
Quoted 6 lines
net/core/dev.c:unregister_netdev() function is a wrapper around net/core/dev.c:unregister_netdevice(). The
unregister_netdevice()function returns a return code whileunregister_netdev()currently does not. For completeness, we should pass the return code fromunregister_netdevice()all the way to the caller.unregister_netdev()should not swallow the return code.
Quoted 5 lines
Quoted 4 lines
Certainly there's some truth in that ;)
Is there some reason why you want to test the
unregister_netdev()return value?The only return value is
-ENODEV, so I would vote for both just being void
Me too.
FWIW, I think bug reports like this are a lot of back-and-forth waste of time. If it's important enough to someone, let them write a god-damn patch for something so amazingly trivial. With the bugzill entry, you have to respond to it, change it's diapers, etc.
PATCH 1/1 net: unregister_netdevice as void
There was no real useful information from the unregister_netdevice() return code, the only error occurred in a situation that was a driver bug. So change it to a void function.
--- include/linux/netdevice.h | 2 +- net/core/dev.c | 15 ++++++--------- net/ipv4/ip_gre.c | 3 ++- net/ipv4/ipip.c | 3 ++- net/ipv6/ip6_tunnel.c | 3 ++- net/ipv6/sit.c | 3 ++- 6 files changed, 15 insertions(+), 14 deletions(-)
include/linux/netdevice.h +1 -1
@@ -588,7 +588,7 @@ extern int dev_open(struct net_device *extern int dev_close (struct net_device *dev);extern int dev_queue_xmit (struct sk_buff *skb);extern int register_netdevice (struct net_device *dev); -extern int unregister_netdevice (struct net_device *dev); +extern void unregister_netdevice (struct net_device *dev);extern void free_netdev (struct net_device *dev);extern void synchronize_net (void );extern int register_netdevice_notifier (struct notifier_block *nb);
net/core/dev.c +6 -9
@@ -3247,7 +3247,7 @@ void synchronize_net(void)* unregister_netdev() instead of this. */ -int unregister_netdevice (struct net_device *dev) +void unregister_netdevice (struct net_device *dev) {struct net_device *d, **dp;
@@ -3258,8 +3258,10 @@ int unregister_netdevice(struct net_deviif (dev->reg_state ==NETREG_UNINITIALIZED ) {printk (KERN_DEBUG "unregister_netdevice: device %s/%p never " "was registered\n" , dev->name, dev); -return -ENODEV ; - } + +WARN_ON (1 ); +return ; + }BUG_ON (dev->reg_state !=NETREG_REGISTERED );
@@ -3280,11 +3282,7 @@ int unregister_netdevice(struct net_devibreak ; } } -if (!d) { -printk (KERN_ERR "unregister net_device: '%s' not found\n" , - dev->name); -return -ENODEV ; - } +BUG_ON (!d); dev->reg_state =NETREG_UNREGISTERING ;
@@ -3316,7 +3314,6 @@ int unregister_netdevice(struct net_devisynchronize_net ();dev_put (dev); -return 0 ; }/**
net/ipv4/ip_gre.c +2 -1
@@ -1008,7 +1008,8 @@ ipgre_tunnel_ioctl (struct net_device *d goto done; dev = t->dev; } - err =unregister_netdevice (dev); +unregister_netdevice (dev); + err =0 ;break ;default :
net/ipv4/ipip.c +2 -1
@@ -754,7 +754,8 @@ ipip_tunnel_ioctl (struct net_device *de goto done; dev = t->dev; } - err =unregister_netdevice (dev); +unregister_netdevice (dev); + err =0 ;break ;default :
net/ipv6/ip6_tunnel.c +2 -1
@@ -999,7 +999,8 @@ ip6ip6_tnl_ioctl(struct net_device *dev,break ; dev = t->dev; } - err =unregister_netdevice (dev); + err =0 ; +unregister_netdevice (dev);break ;default : err = -EINVAL ;
net/ipv6/sit.c +2 -1
@@ -686,7 +686,8 @@ ipip6_tunnel_ioctl (struct net_device *d goto done; dev = t->dev; } - err =unregister_netdevice (dev); +unregister_netdevice (dev); + err =0 ;break ;default :
Signature · 1 line
1.4.2.4
Re: [PATCH] net: unregister_netdevice as void
From: Stephen Hemminger <[email protected]>
Date: Mon, 18 Dec 2006 21:05:11 -0800
Quoted 5 lines
There was no real useful information from the
unregister_netdevice()return code, the only error occurred in a situation that was a driver bug. So change it to a void function.Signed-off-by Stephen Hemminger <[email protected]>
Applied to net-2.6.21, thanks Stephen.