bonding: use the correct function to check for netdev name collision
authorAntoine Tenart <atenart@kernel.org>
Thu, 7 Oct 2021 16:16:51 +0000 (18:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Oct 2021 16:02:34 +0000 (17:02 +0100)
A new helper to detect if a net device name is in use was added. Use it
here as the return reference from __dev_get_by_name was discarded.

Signed-off-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_sysfs.c

index b9e9842..c48b771 100644 (file)
@@ -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_in_use(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;