bonding: fix error checking in bond_debug_reregister()
authorQi Zheng <zhengqi.arch@bytedance.com>
Thu, 2 Feb 2023 09:32:55 +0000 (17:32 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 4 Feb 2023 03:22:20 +0000 (19:22 -0800)
Since commit ff9fb72bc077 ("debugfs: return error values,
not NULL") changed return value of debugfs_rename() in
error cases from %NULL to %ERR_PTR(-ERROR), we should
also check error values instead of NULL.

Fixes: ff9fb72bc077 ("debugfs: return error values, not NULL")
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Link: https://lore.kernel.org/r/20230202093256.32458-1-zhengqi.arch@bytedance.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/bonding/bond_debugfs.c

index 4f9b4a18c74cdc767298ad4b2c17fdab17333151..5940945266489abccc21c30ad3bcb8f971832655 100644 (file)
@@ -76,7 +76,7 @@ void bond_debug_reregister(struct bonding *bond)
 
        d = debugfs_rename(bonding_debug_root, bond->debug_dir,
                           bonding_debug_root, bond->dev->name);
-       if (d) {
+       if (!IS_ERR(d)) {
                bond->debug_dir = d;
        } else {
                netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n");