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

USB: gadget: udc: bcm63xx_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: Kevin Cernekee <cernekee@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+5 -32
+5 -32
drivers/usb/gadget/udc/bcm63xx_udc.c
··· 288 288 * @ep0_reply: Pending reply from gadget driver. 289 289 * @ep0_request: Outstanding ep0 request. 290 290 * @debugfs_root: debugfs directory: /sys/kernel/debug/<DRV_MODULE_NAME>. 291 - * @debugfs_usbd: debugfs file "usbd" for controller state. 292 - * @debugfs_iudma: debugfs file "usbd" for IUDMA state. 293 291 */ 294 292 struct bcm63xx_udc { 295 293 spinlock_t lock; ··· 328 330 struct usb_request *ep0_request; 329 331 330 332 struct dentry *debugfs_root; 331 - struct dentry *debugfs_usbd; 332 - struct dentry *debugfs_iudma; 333 333 }; 334 334 335 335 static const struct usb_ep_ops bcm63xx_udc_ep_ops; ··· 2243 2247 */ 2244 2248 static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc) 2245 2249 { 2246 - struct dentry *root, *usbd, *iudma; 2250 + struct dentry *root; 2247 2251 2248 2252 if (!IS_ENABLED(CONFIG_USB_GADGET_DEBUG_FS)) 2249 2253 return; 2250 2254 2251 2255 root = debugfs_create_dir(udc->gadget.name, NULL); 2252 - if (IS_ERR(root) || !root) 2253 - goto err_root; 2254 - 2255 - usbd = debugfs_create_file("usbd", 0400, root, udc, 2256 - &bcm63xx_usbd_dbg_fops); 2257 - if (!usbd) 2258 - goto err_usbd; 2259 - iudma = debugfs_create_file("iudma", 0400, root, udc, 2260 - &bcm63xx_iudma_dbg_fops); 2261 - if (!iudma) 2262 - goto err_iudma; 2263 - 2264 2256 udc->debugfs_root = root; 2265 - udc->debugfs_usbd = usbd; 2266 - udc->debugfs_iudma = iudma; 2267 - return; 2268 - err_iudma: 2269 - debugfs_remove(usbd); 2270 - err_usbd: 2271 - debugfs_remove(root); 2272 - err_root: 2273 - dev_err(udc->dev, "debugfs is not available\n"); 2257 + 2258 + debugfs_create_file("usbd", 0400, root, udc, &bcm63xx_usbd_dbg_fops); 2259 + debugfs_create_file("iudma", 0400, root, udc, &bcm63xx_iudma_dbg_fops); 2274 2260 } 2275 2261 2276 2262 /** ··· 2263 2285 */ 2264 2286 static void bcm63xx_udc_cleanup_debugfs(struct bcm63xx_udc *udc) 2265 2287 { 2266 - debugfs_remove(udc->debugfs_iudma); 2267 - debugfs_remove(udc->debugfs_usbd); 2268 - debugfs_remove(udc->debugfs_root); 2269 - udc->debugfs_iudma = NULL; 2270 - udc->debugfs_usbd = NULL; 2271 - udc->debugfs_root = NULL; 2288 + debugfs_remove_recursive(udc->debugfs_root); 2272 2289 } 2273 2290 2274 2291 /***********************************************************************