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

USB: fhci-hcd: 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 host controller structure.

Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+5 -20
+5 -18
drivers/usb/host/fhci-dbg.c
··· 83 83 struct device *dev = fhci_to_hcd(fhci)->self.controller; 84 84 85 85 fhci->dfs_root = debugfs_create_dir(dev_name(dev), usb_debug_root); 86 - if (!fhci->dfs_root) { 87 - WARN_ON(1); 88 - return; 89 - } 90 86 91 - fhci->dfs_regs = debugfs_create_file("regs", S_IFREG | S_IRUGO, 92 - fhci->dfs_root, fhci, &fhci_dfs_regs_fops); 93 - 94 - fhci->dfs_irq_stat = debugfs_create_file("irq_stat", 95 - S_IFREG | S_IRUGO, fhci->dfs_root, fhci, 96 - &fhci_dfs_irq_stat_fops); 97 - 98 - WARN_ON(!fhci->dfs_regs || !fhci->dfs_irq_stat); 87 + debugfs_create_file("regs", S_IFREG | S_IRUGO, fhci->dfs_root, fhci, 88 + &fhci_dfs_regs_fops); 89 + debugfs_create_file("irq_stat", S_IFREG | S_IRUGO, fhci->dfs_root, fhci, 90 + &fhci_dfs_irq_stat_fops); 99 91 } 100 92 101 93 void fhci_dfs_destroy(struct fhci_hcd *fhci) 102 94 { 103 - if (!fhci->dfs_root) 104 - return; 105 - 106 - debugfs_remove(fhci->dfs_irq_stat); 107 - debugfs_remove(fhci->dfs_regs); 108 - debugfs_remove(fhci->dfs_root); 95 + debugfs_remove_recursive(fhci->dfs_root); 109 96 }
-2
drivers/usb/host/fhci.h
··· 262 262 #ifdef CONFIG_FHCI_DEBUG 263 263 int usb_irq_stat[13]; 264 264 struct dentry *dfs_root; 265 - struct dentry *dfs_regs; 266 - struct dentry *dfs_irq_stat; 267 265 #endif 268 266 }; 269 267