Skip to content

Commit da6d719

Browse files
committed
thermal/debugfs: Fix the NULL vs IS_ERR() confusion in debugfs_create_dir()
JIRA: https://issues.redhat.com/browse/RHEL-61357 commit 57df60e Author: Yang Ruibin <[email protected]> Date: Wed Aug 21 03:59:33 2024 -0400 thermal/debugfs: Fix the NULL vs IS_ERR() confusion in debugfs_create_dir() The debugfs_create_dir() return value is never NULL, it is either a valid pointer or an error one. Use IS_ERR() to check it. Fixes: 7ef01f2 ("thermal/debugfs: Add thermal debugfs information for mitigation episodes") Fixes: 755113d ("thermal/debugfs: Add thermal cooling device debugfs information") Signed-off-by: Yang Ruibin <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: David Arcari <[email protected]>
1 parent 45ec836 commit da6d719

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/thermal/thermal_debugfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ struct thermal_debugfs {
178178
void thermal_debug_init(void)
179179
{
180180
d_root = debugfs_create_dir("thermal", NULL);
181-
if (!d_root)
181+
if (IS_ERR(d_root))
182182
return;
183183

184184
d_cdev = debugfs_create_dir("cooling_devices", d_root);
185-
if (!d_cdev)
185+
if (IS_ERR(d_cdev))
186186
return;
187187

188188
d_tz = debugfs_create_dir("thermal_zones", d_root);
@@ -202,7 +202,7 @@ static struct thermal_debugfs *thermal_debugfs_add_id(struct dentry *d, int id)
202202
snprintf(ids, IDSLENGTH, "%d", id);
203203

204204
thermal_dbg->d_top = debugfs_create_dir(ids, d);
205-
if (!thermal_dbg->d_top) {
205+
if (IS_ERR(thermal_dbg->d_top)) {
206206
kfree(thermal_dbg);
207207
return NULL;
208208
}

0 commit comments

Comments
 (0)