Skip to content

Commit d808aa6

Browse files
author
Russell King
committed
ARM: cleanup: debugfs error handling
Debugfs functions return NULL when they fail, or an error pointer when not configured. The intention behind the error pointer is that it appears as a valid pointer to the caller, and so the caller continues inspite of debugfs not being available. Debugfs failure should only ever be checked with (!ptr) and not the IS_ERR*() functions. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 23cbd4e commit d808aa6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm/mach-omap2/pm-debug.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
219219
return 0;
220220

221221
d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
222-
if (!(IS_ERR_OR_NULL(d)))
222+
if (d)
223223
(void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
224224
(void *)pwrdm, &pwrdm_suspend_fops);
225225

@@ -263,8 +263,8 @@ static int __init pm_dbg_init(void)
263263
return 0;
264264

265265
d = debugfs_create_dir("pm_debug", NULL);
266-
if (IS_ERR_OR_NULL(d))
267-
return PTR_ERR(d);
266+
if (!d)
267+
return -EINVAL;
268268

269269
(void) debugfs_create_file("count", S_IRUGO,
270270
d, (void *)DEBUG_FILE_COUNTERS, &debug_fops);

0 commit comments

Comments
 (0)