Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+2 -6
+2 -5
drivers/usb/gadget/udc/gr_udc.c
··· 209 209 const char *name = "gr_udc_state"; 210 210 211 211 dev->dfs_root = debugfs_create_dir(dev_name(dev->dev), NULL); 212 - dev->dfs_state = debugfs_create_file(name, 0444, dev->dfs_root, dev, 213 - &gr_dfs_fops); 212 + debugfs_create_file(name, 0444, dev->dfs_root, dev, &gr_dfs_fops); 214 213 } 215 214 216 215 static void gr_dfs_delete(struct gr_udc *dev) 217 216 { 218 - /* Handles NULL and ERR pointers internally */ 219 - debugfs_remove(dev->dfs_state); 220 - debugfs_remove(dev->dfs_root); 217 + debugfs_remove_recursive(dev->dfs_root); 221 218 } 222 219 223 220 #else /* !CONFIG_USB_GADGET_DEBUG_FS */
-1
drivers/usb/gadget/udc/gr_udc.h
··· 217 217 spinlock_t lock; /* General lock, a.k.a. "dev->lock" in comments */ 218 218 219 219 struct dentry *dfs_root; 220 - struct dentry *dfs_state; 221 220 }; 222 221 223 222 #define to_gr_udc(gadget) (container_of((gadget), struct gr_udc, gadget))