usb: diag: Remove debugfs nodes during cleanup

Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
diff --git a/drivers/usb/gadget/f_diag.c b/drivers/usb/gadget/f_diag.c
index f950286..0510547 100644
--- a/drivers/usb/gadget/f_diag.c
+++ b/drivers/usb/gadget/f_diag.c
@@ -711,15 +711,14 @@
 	.write = debug_reset_stats,
 };
 
+struct dentry *dent_diag;
 static void fdiag_debugfs_init(void)
 {
-	struct dentry *dent;
-
-	dent = debugfs_create_dir("usb_diag", 0);
-	if (IS_ERR(dent))
+	dent_diag = debugfs_create_dir("usb_diag", 0);
+	if (IS_ERR(dent_diag))
 		return;
 
-	debugfs_create_file("status", 0444, dent, 0, &debug_fdiag_ops);
+	debugfs_create_file("status", 0444, dent_diag, 0, &debug_fdiag_ops);
 }
 #else
 static void fdiag_debugfs_init(void)
@@ -735,6 +734,8 @@
 	struct usb_diag_ch *_ch;
 	unsigned long flags;
 
+	debugfs_remove_recursive(dent_diag);
+
 	list_for_each_safe(act, tmp, &usb_diag_ch_list) {
 		_ch = list_entry(act, struct usb_diag_ch, list);
 		dev = container_of(_ch, struct diag_context, ch);
@@ -746,7 +747,6 @@
 			kfree(dev);
 		}
 		spin_unlock_irqrestore(&ch_lock, flags);
-
 	}
 }