Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
[firefly-linux-kernel-4.4.55.git] / drivers / usb / mon / mon_text.c
index c302e1983c70dfa6fd911614b09664450b298b95..1c3afcc11bd91584d87c49e62f89498d52c68d21 100644 (file)
@@ -670,6 +670,9 @@ int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus)
        int busnum = ubus? ubus->busnum: 0;
        int rc;
 
+       if (mon_dir == NULL)
+               return 0;
+
        if (ubus != NULL) {
                rc = snprintf(name, NAMESZ, "%dt", busnum);
                if (rc <= 0 || rc >= NAMESZ)
@@ -740,12 +743,12 @@ int __init mon_text_init(void)
 
        mondir = debugfs_create_dir("usbmon", usb_debug_root);
        if (IS_ERR(mondir)) {
-               printk(KERN_NOTICE TAG ": debugfs is not available\n");
-               return -ENODEV;
+               /* debugfs not available, but we can use usbmon without it */
+               return 0;
        }
        if (mondir == NULL) {
                printk(KERN_NOTICE TAG ": unable to create usbmon directory\n");
-               return -ENODEV;
+               return -ENOMEM;
        }
        mon_dir = mondir;
        return 0;