Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37ea7107 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

USB: gadget: udc: gr_udc: 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.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Jaejoong Kim <climbbb.kim@gmail.com>
Cc: Li Yang <leoyang.li@nxp.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent da281a8e
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -209,15 +209,12 @@ static void gr_dfs_create(struct gr_udc *dev)
	const char *name = "gr_udc_state";

	dev->dfs_root = debugfs_create_dir(dev_name(dev->dev), NULL);
	dev->dfs_state = debugfs_create_file(name, 0444, dev->dfs_root, dev,
					     &gr_dfs_fops);
	debugfs_create_file(name, 0444, dev->dfs_root, dev, &gr_dfs_fops);
}

static void gr_dfs_delete(struct gr_udc *dev)
{
	/* Handles NULL and ERR pointers internally */
	debugfs_remove(dev->dfs_state);
	debugfs_remove(dev->dfs_root);
	debugfs_remove_recursive(dev->dfs_root);
}

#else /* !CONFIG_USB_GADGET_DEBUG_FS */
+0 −1
Original line number Diff line number Diff line
@@ -217,7 +217,6 @@ struct gr_udc {
	spinlock_t lock; /* General lock, a.k.a. "dev->lock" in comments */

	struct dentry *dfs_root;
	struct dentry *dfs_state;
};

#define to_gr_udc(gadget)	(container_of((gadget), struct gr_udc, gadget))