[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210928125500.167943-5-atenart@kernel.org>
Date: Tue, 28 Sep 2021 14:54:55 +0200
From: Antoine Tenart <atenart@...nel.org>
To: davem@...emloft.net, kuba@...nel.org
Cc: Antoine Tenart <atenart@...nel.org>, pabeni@...hat.com,
gregkh@...uxfoundation.org, ebiederm@...ssion.com,
stephen@...workplumber.org, herbert@...dor.apana.org.au,
juri.lelli@...hat.com, netdev@...r.kernel.org
Subject: [RFC PATCH net-next 4/9] bonding: use the correct function to check for netdev name collision
netdev_name_node_lookup and __dev_get_by_name have two distinct aims,
one helps in name collision detection, while the other is used to
retrieve a reference to a net device from its name. Here in
bond_create_sysfs we want to check for a name collision, hence use the
correct function.
(The behaviour of the two functions was similar but will change in the
next commits).
Signed-off-by: Antoine Tenart <atenart@...nel.org>
---
drivers/net/bonding/bond_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index b9e9842fed94..8260bf941ca3 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -811,8 +811,8 @@ int bond_create_sysfs(struct bond_net *bn)
*/
if (ret == -EEXIST) {
/* Is someone being kinky and naming a device bonding_master? */
- if (__dev_get_by_name(bn->net,
- class_attr_bonding_masters.attr.name))
+ if (netdev_name_node_lookup(bn->net,
+ class_attr_bonding_masters.attr.name))
pr_err("network device named %s already exists in sysfs\n",
class_attr_bonding_masters.attr.name);
ret = 0;
--
2.31.1
Powered by blists - more mailing lists