netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: propagate dev_get_valid_name return code
@ 2018-06-19  9:23 Li RongQing
  2018-06-19 23:38 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Li RongQing @ 2018-06-19  9:23 UTC (permalink / raw)
  To: netdev

if dev_get_valid_name failed, propagate its return code

and remove the setting err to ENODEV, it will be set to
0 again before dev_change_net_namespace exits.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/core/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 1844d9bc5714..1c7a3761ec3c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8661,7 +8661,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
 		/* We get here if we can't use the current device name */
 		if (!pat)
 			goto out;
-		if (dev_get_valid_name(net, dev, pat) < 0)
+		err = dev_get_valid_name(net, dev, pat);
+		if (err < 0)
 			goto out;
 	}
 
@@ -8673,7 +8674,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
 	dev_close(dev);
 
 	/* And unlink it from device chain */
-	err = -ENODEV;
 	unlist_netdevice(dev);
 
 	synchronize_net();
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: propagate dev_get_valid_name return code
  2018-06-19  9:23 [PATCH] net: propagate dev_get_valid_name return code Li RongQing
@ 2018-06-19 23:38 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-06-19 23:38 UTC (permalink / raw)
  To: lirongqing; +Cc: netdev

From: Li RongQing <lirongqing@baidu.com>
Date: Tue, 19 Jun 2018 17:23:17 +0800

> if dev_get_valid_name failed, propagate its return code
> 
> and remove the setting err to ENODEV, it will be set to
> 0 again before dev_change_net_namespace exits.
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-19 23:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-19  9:23 [PATCH] net: propagate dev_get_valid_name return code Li RongQing
2018-06-19 23:38 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).