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

USB: mon: Allow to use usbmon without debugfs

Do not bail out with an error in mon_text_init() if debugfs is not
available, instead just return 0 and let mon_init() go ahead with
loading the binary API. Return -ENOMEM in case debugfs_create_dir()
fails for other reasons. Later, it is enough to check for mon_dir
not set.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Tobias Klauser and committed by
Greg Kroah-Hartman
8dec92b2 004c1968

+6 -3
+6 -3
drivers/usb/mon/mon_text.c
··· 670 670 int busnum = ubus? ubus->busnum: 0; 671 671 int rc; 672 672 673 + if (mon_dir == NULL) 674 + return 0; 675 + 673 676 if (ubus != NULL) { 674 677 rc = snprintf(name, NAMESZ, "%dt", busnum); 675 678 if (rc <= 0 || rc >= NAMESZ) ··· 743 740 744 741 mondir = debugfs_create_dir("usbmon", usb_debug_root); 745 742 if (IS_ERR(mondir)) { 746 - printk(KERN_NOTICE TAG ": debugfs is not available\n"); 747 - return -ENODEV; 743 + /* debugfs not available, but we can use usbmon without it */ 744 + return 0; 748 745 } 749 746 if (mondir == NULL) { 750 747 printk(KERN_NOTICE TAG ": unable to create usbmon directory\n"); 751 - return -ENODEV; 748 + return -ENOMEM; 752 749 } 753 750 mon_dir = mondir; 754 751 return 0;