ARM: cleanup: debugfs error handling
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 24 Feb 2013 10:52:18 +0000 (10:52 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 24 Feb 2013 10:52:18 +0000 (10:52 +0000)
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>
arch/arm/mach-omap2/pm-debug.c

index e2c291f52f925b360253add1dc7f4921233bec8b..548547e147969de2e161d73a9902d1c123d62cb8 100644 (file)
@@ -219,7 +219,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
                return 0;
 
        d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
-       if (!(IS_ERR_OR_NULL(d)))
+       if (d)
                (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
                        (void *)pwrdm, &pwrdm_suspend_fops);
 
@@ -263,8 +263,8 @@ static int __init pm_dbg_init(void)
                return 0;
 
        d = debugfs_create_dir("pm_debug", NULL);
-       if (IS_ERR_OR_NULL(d))
-               return PTR_ERR(d);
+       if (!d)
+               return -EINVAL;
 
        (void) debugfs_create_file("count", S_IRUGO,
                d, (void *)DEBUG_FILE_COUNTERS, &debug_fops);
This page took 0.026049 seconds and 5 git commands to generate.