Re: [PATCH 2/4] usb: gadget: udc: renesas_usb3: should remove debugfs

2018-04-09 Thread Simon Horman
On Mon, Apr 02, 2018 at 09:21:32PM +0900, Yoshihiro Shimoda wrote:
> 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:  # v4.14+
> Signed-off-by: Yoshihiro Shimoda 

Reviewed-by: Simon Horman 



[PATCH 2/4] usb: gadget: udc: renesas_usb3: should remove debugfs

2018-04-02 Thread Yoshihiro Shimoda
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:  # v4.14+
Signed-off-by: Yoshihiro Shimoda 
---
 drivers/usb/gadget/udc/renesas_usb3.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c 
b/drivers/usb/gadget/udc/renesas_usb3.c
index 78a12a5..1c54a77 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -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;
@@ -2393,8 +2394,12 @@ static void renesas_usb3_debugfs_init(struct 
renesas_usb3 *usb3,
 
file = debugfs_create_file("b_device", 0644, root, usb3,
   _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 */
@@ -2402,6 +2407,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(>dev, _attr_role);
 
usb_del_gadget_udc(>gadget);
-- 
1.9.1