Commit 1012592c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

watchdog: mei_wdt: no need to check return value of debugfs_create functions



When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-watchdog@vger.kernel.org
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 200f3a3f
Loading
Loading
Loading
Loading
+7 −23
Original line number Diff line number Diff line
@@ -539,38 +539,23 @@ static void dbgfs_unregister(struct mei_wdt *wdt)
	wdt->dbgfs_dir = NULL;
}

static int dbgfs_register(struct mei_wdt *wdt)
static void dbgfs_register(struct mei_wdt *wdt)
{
	struct dentry *dir, *f;
	struct dentry *dir;

	dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
	if (!dir)
		return -ENOMEM;

	wdt->dbgfs_dir = dir;
	f = debugfs_create_file("state", S_IRUSR, dir, wdt, &dbgfs_fops_state);
	if (!f)
		goto err;

	f = debugfs_create_file("activation",  S_IRUSR,
				dir, wdt, &dbgfs_fops_activation);
	if (!f)
		goto err;
	debugfs_create_file("state", S_IRUSR, dir, wdt, &dbgfs_fops_state);

	return 0;
err:
	dbgfs_unregister(wdt);
	return -ENODEV;
	debugfs_create_file("activation", S_IRUSR, dir, wdt,
			    &dbgfs_fops_activation);
}

#else

static inline void dbgfs_unregister(struct mei_wdt *wdt) {}

static inline int dbgfs_register(struct mei_wdt *wdt)
{
	return 0;
}
static inline void dbgfs_register(struct mei_wdt *wdt) {}
#endif /* CONFIG_DEBUG_FS */

static int mei_wdt_probe(struct mei_cl_device *cldev,
@@ -623,8 +608,7 @@ static int mei_wdt_probe(struct mei_cl_device *cldev,
	if (ret)
		goto err_disable;

	if (dbgfs_register(wdt))
		dev_warn(&cldev->dev, "cannot register debugfs\n");
	dbgfs_register(wdt);

	return 0;