aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-29 11:30:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-31 06:54:21 -0400
commit63c4c0d8818fa2e48d546cd2c22659e6b59e8db5 (patch)
treede03a26ac9497eba635f43f2fd8038d618dbfa41
parent377058707eed2be62bc200fbfa9db544dbe7d439 (diff)
USB: ohci: 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: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/ohci-dbg.c45
-rw-r--r--drivers/usb/host/ohci-hcd.c5
-rw-r--r--drivers/usb/host/ohci.h3
3 files changed, 9 insertions, 44 deletions
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index ac7d4ac34b02..d3ee1f52aaab 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -762,50 +762,23 @@ static int debug_registers_open(struct inode *inode, struct file *file)
762static inline void create_debug_files (struct ohci_hcd *ohci) 762static inline void create_debug_files (struct ohci_hcd *ohci)
763{ 763{
764 struct usb_bus *bus = &ohci_to_hcd(ohci)->self; 764 struct usb_bus *bus = &ohci_to_hcd(ohci)->self;
765 struct dentry *root;
765 766
766 ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root); 767 root = debugfs_create_dir(bus->bus_name, ohci_debug_root);
767 if (!ohci->debug_dir) 768 ohci->debug_dir = root;
768 goto dir_error;
769 769
770 ohci->debug_async = debugfs_create_file("async", S_IRUGO, 770 debugfs_create_file("async", S_IRUGO, root, ohci, &debug_async_fops);
771 ohci->debug_dir, ohci, 771 debugfs_create_file("periodic", S_IRUGO, root, ohci,
772 &debug_async_fops); 772 &debug_periodic_fops);
773 if (!ohci->debug_async) 773 debugfs_create_file("registers", S_IRUGO, root, ohci,
774 goto async_error; 774 &debug_registers_fops);
775
776 ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
777 ohci->debug_dir, ohci,
778 &debug_periodic_fops);
779 if (!ohci->debug_periodic)
780 goto periodic_error;
781
782 ohci->debug_registers = debugfs_create_file("registers", S_IRUGO,
783 ohci->debug_dir, ohci,
784 &debug_registers_fops);
785 if (!ohci->debug_registers)
786 goto registers_error;
787 775
788 ohci_dbg (ohci, "created debug files\n"); 776 ohci_dbg (ohci, "created debug files\n");
789 return;
790
791registers_error:
792 debugfs_remove(ohci->debug_periodic);
793periodic_error:
794 debugfs_remove(ohci->debug_async);
795async_error:
796 debugfs_remove(ohci->debug_dir);
797dir_error:
798 ohci->debug_periodic = NULL;
799 ohci->debug_async = NULL;
800 ohci->debug_dir = NULL;
801} 777}
802 778
803static inline void remove_debug_files (struct ohci_hcd *ohci) 779static inline void remove_debug_files (struct ohci_hcd *ohci)
804{ 780{
805 debugfs_remove(ohci->debug_registers); 781 debugfs_remove_recursive(ohci->debug_dir);
806 debugfs_remove(ohci->debug_periodic);
807 debugfs_remove(ohci->debug_async);
808 debugfs_remove(ohci->debug_dir);
809} 782}
810 783
811/*-------------------------------------------------------------------------*/ 784/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 4806e0f9e8d4..210181fd98d2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1258,10 +1258,6 @@ static int __init ohci_hcd_mod_init(void)
1258 set_bit(USB_OHCI_LOADED, &usb_hcds_loaded); 1258 set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
1259 1259
1260 ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root); 1260 ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root);
1261 if (!ohci_debug_root) {
1262 retval = -ENOENT;
1263 goto error_debug;
1264 }
1265 1261
1266#ifdef PS3_SYSTEM_BUS_DRIVER 1262#ifdef PS3_SYSTEM_BUS_DRIVER
1267 retval = ps3_ohci_driver_register(&PS3_SYSTEM_BUS_DRIVER); 1263 retval = ps3_ohci_driver_register(&PS3_SYSTEM_BUS_DRIVER);
@@ -1318,7 +1314,6 @@ static int __init ohci_hcd_mod_init(void)
1318#endif 1314#endif
1319 debugfs_remove(ohci_debug_root); 1315 debugfs_remove(ohci_debug_root);
1320 ohci_debug_root = NULL; 1316 ohci_debug_root = NULL;
1321 error_debug:
1322 1317
1323 clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); 1318 clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
1324 return retval; 1319 return retval;
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 508a803139dd..ef4813bfc5bf 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -431,9 +431,6 @@ struct ohci_hcd {
431 struct work_struct nec_work; /* Worker for NEC quirk */ 431 struct work_struct nec_work; /* Worker for NEC quirk */
432 432
433 struct dentry *debug_dir; 433 struct dentry *debug_dir;
434 struct dentry *debug_async;
435 struct dentry *debug_periodic;
436 struct dentry *debug_registers;
437 434
438 /* platform-specific data -- must come last */ 435 /* platform-specific data -- must come last */
439 unsigned long priv[0] __aligned(sizeof(s64)); 436 unsigned long priv[0] __aligned(sizeof(s64));