OPP: fix error checking in opp_migrate_dentry()
authorQi Zheng <zhengqi.arch@bytedance.com>
Wed, 8 Feb 2023 04:00:37 +0000 (12:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Feb 2023 12:48:53 +0000 (13:48 +0100)
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>
Link: https://lore.kernel.org/r/20230208040037.60305-1-zhengqi.arch@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/opp/debugfs.c

index 96a30a0..2c7fb68 100644 (file)
@@ -235,7 +235,7 @@ static void opp_migrate_dentry(struct opp_device *opp_dev,
 
        dentry = debugfs_rename(rootdir, opp_dev->dentry, rootdir,
                                opp_table->dentry_name);
-       if (!dentry) {
+       if (IS_ERR(dentry)) {
                dev_err(dev, "%s: Failed to rename link from: %s to %s\n",
                        __func__, dev_name(opp_dev->dev), dev_name(dev));
                return;