Skip to contentSkip to conversation

platform/x86: intel_telemetry_debugfs: fix some error codes in init

PATCH In review Dan Carpenter 2 participants 2 messages Jun 30, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: intel_telemetry_debugfs: fix some error codes in init

There are bunch of "goto out;" paths where we don't set the error code.

drivers/platform/x86/intel_telemetry_debugfs.c +3 -4
index 4cc2f4ea0a25..b8be058a8754 100644
@@ -938,7 +938,7 @@ static struct notifier_block pm_notifier = {
 static int __init telemetry_debugfs_init(void)
 {
 	const struct x86_cpu_id *id;
-	int err = -ENOMEM;
+	int err;
 	struct dentry *f;
 
 	/* Only APL supported for now */
@@ -958,11 +958,10 @@ static int __init telemetry_debugfs_init(void)
 
 	register_pm_notifier(&pm_notifier);
 
+	err = -ENOMEM;
 	debugfs_conf->telemetry_dbg_dir = debugfs_create_dir("telemetry", NULL);
-	if (!debugfs_conf->telemetry_dbg_dir) {
-		err = -ENOMEM;
+	if (!debugfs_conf->telemetry_dbg_dir)
 		goto out_pm;
-	}
 
 	f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO,
 				debugfs_conf->telemetry_dbg_dir, NULL,
#1 lore raw
Quoted 2 lines · Dan Carpenter

There are bunch of "goto out;" paths where we don't set the error code.

Applied for testing, thanks!

Quoted 29 lines
drivers/platform/x86/intel_telemetry_debugfs.c +3 -4
index 4cc2f4ea0a25..b8be058a8754 100644
@@ -938,7 +938,7 @@ static struct notifier_block pm_notifier = {
 static int __init telemetry_debugfs_init(void)
 {
        const struct x86_cpu_id *id;
-       int err = -ENOMEM;
+       int err;
        struct dentry *f;
 
        /* Only APL supported for now */
@@ -958,11 +958,10 @@ static int __init telemetry_debugfs_init(void)
 
        register_pm_notifier(&pm_notifier);
 
+       err = -ENOMEM;
        debugfs_conf->telemetry_dbg_dir = debugfs_create_dir("telemetry", NULL);
-       if (!debugfs_conf->telemetry_dbg_dir) {
-               err = -ENOMEM;
+       if (!debugfs_conf->telemetry_dbg_dir)
                goto out_pm;
-       }
 
        f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO,
                                debugfs_conf->telemetry_dbg_dir, NULL,
Signature · 2 lines
With Best Regards,
Andy Shevchenko