2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 14:43:58 +08:00

USB: gadget: udc: pxa27x_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: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2018-05-29 17:31:05 +02:00
parent 37ea71074d
commit edbeb6bc69
2 changed files with 6 additions and 40 deletions

View File

@ -205,50 +205,19 @@ DEFINE_SHOW_ATTRIBUTE(eps_dbg);
static void pxa_init_debugfs(struct pxa_udc *udc) static void pxa_init_debugfs(struct pxa_udc *udc)
{ {
struct dentry *root, *state, *queues, *eps; struct dentry *root;
root = debugfs_create_dir(udc->gadget.name, NULL); root = debugfs_create_dir(udc->gadget.name, NULL);
if (IS_ERR(root) || !root)
goto err_root;
state = debugfs_create_file("udcstate", 0400, root, udc,
&state_dbg_fops);
if (!state)
goto err_state;
queues = debugfs_create_file("queues", 0400, root, udc,
&queues_dbg_fops);
if (!queues)
goto err_queues;
eps = debugfs_create_file("epstate", 0400, root, udc,
&eps_dbg_fops);
if (!eps)
goto err_eps;
udc->debugfs_root = root; udc->debugfs_root = root;
udc->debugfs_state = state;
udc->debugfs_queues = queues; debugfs_create_file("udcstate", 0400, root, udc, &state_dbg_fops);
udc->debugfs_eps = eps; debugfs_create_file("queues", 0400, root, udc, &queues_dbg_fops);
return; debugfs_create_file("epstate", 0400, root, udc, &eps_dbg_fops);
err_eps:
debugfs_remove(eps);
err_queues:
debugfs_remove(queues);
err_state:
debugfs_remove(root);
err_root:
dev_err(udc->dev, "debugfs is not available\n");
} }
static void pxa_cleanup_debugfs(struct pxa_udc *udc) static void pxa_cleanup_debugfs(struct pxa_udc *udc)
{ {
debugfs_remove(udc->debugfs_eps); debugfs_remove_recursive(udc->debugfs_root);
debugfs_remove(udc->debugfs_queues);
debugfs_remove(udc->debugfs_state);
debugfs_remove(udc->debugfs_root);
udc->debugfs_eps = NULL;
udc->debugfs_queues = NULL;
udc->debugfs_state = NULL;
udc->debugfs_root = NULL;
} }
#else #else

View File

@ -476,9 +476,6 @@ struct pxa_udc {
#endif #endif
#ifdef CONFIG_USB_GADGET_DEBUG_FS #ifdef CONFIG_USB_GADGET_DEBUG_FS
struct dentry *debugfs_root; struct dentry *debugfs_root;
struct dentry *debugfs_state;
struct dentry *debugfs_queues;
struct dentry *debugfs_eps;
#endif #endif
}; };
#define to_pxa(g) (container_of((g), struct pxa_udc, gadget)) #define to_pxa(g) (container_of((g), struct pxa_udc, gadget))