]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
usb: gadget: udc: renesas_usb3: should remove debugfs
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tue, 10 Apr 2018 05:38:50 +0000 (14:38 +0900)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 5 Sep 2018 08:30:45 +0000 (10:30 +0200)
BugLink: http://bugs.launchpad.net/bugs/1790188
commit 1990cf7c21ea185cec98c6d45a82c04481261e35 upstream.

This patch fixes an issue that this driver doesn't remove its debugfs.

Fixes: 43ba968b00ea ("usb: gadget: udc: renesas_usb3: add debugfs to set the b-device mode")
Cc: <stable@vger.kernel.org> # v4.14+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/usb/gadget/udc/renesas_usb3.c

index 2b9ee7ebd7cbf01ad979bd758f6f39a5fc18fcd6..44340416bcc998ee0209b96219a150ea447872eb 100644 (file)
@@ -333,6 +333,7 @@ struct renesas_usb3 {
        struct extcon_dev *extcon;
        struct work_struct extcon_work;
        struct phy *phy;
+       struct dentry *dentry;
 
        struct renesas_usb3_ep *usb3_ep;
        int num_usb3_eps;
@@ -2400,8 +2401,12 @@ static void renesas_usb3_debugfs_init(struct renesas_usb3 *usb3,
 
        file = debugfs_create_file("b_device", 0644, root, usb3,
                                   &renesas_usb3_b_device_fops);
-       if (!file)
+       if (!file) {
                dev_info(dev, "%s: Can't create debugfs mode\n", __func__);
+               debugfs_remove_recursive(root);
+       } else {
+               usb3->dentry = root;
+       }
 }
 
 /*------- platform_driver ------------------------------------------------*/
@@ -2409,6 +2414,7 @@ static int renesas_usb3_remove(struct platform_device *pdev)
 {
        struct renesas_usb3 *usb3 = platform_get_drvdata(pdev);
 
+       debugfs_remove_recursive(usb3->dentry);
        device_remove_file(&pdev->dev, &dev_attr_role);
 
        usb_del_gadget_udc(&usb3->gadget);