linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: typec: tcpm: free log buf memory when remove debug file
@ 2019-07-17  8:06 jun.li
  2019-07-17  8:06 ` [PATCH 2/2] usb: typec: tcpm: remove tcpm dir if no children jun.li
  2019-07-17 13:32 ` [PATCH 1/2] usb: typec: tcpm: free log buf memory when remove debug file Guenter Roeck
  0 siblings, 2 replies; 4+ messages in thread
From: jun.li @ 2019-07-17  8:06 UTC (permalink / raw)
  To: linux, heikki.krogerus; +Cc: gregkh, linux-usb, linux-imx

From: Li Jun <jun.li@nxp.com>

The logbuffer memory should be freed when remove debug file.

Cc: stable@vger.kernel.org # v4.15+
Fixes: 4b4e02c83167 ("typec: tcpm: Move out of staging")
Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index fba32d8..1249d8e 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -586,6 +586,15 @@ static void tcpm_debugfs_init(struct tcpm_port *port)
 
 static void tcpm_debugfs_exit(struct tcpm_port *port)
 {
+	int i;
+
+	mutex_lock(&port->logbuffer_lock);
+	for (i = 0; i < LOG_BUFFER_ENTRIES; i++) {
+		kfree(port->logbuffer[i]);
+		port->logbuffer[i] = NULL;
+	}
+	mutex_unlock(&port->logbuffer_lock);
+
 	debugfs_remove(port->dentry);
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-17 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17  8:06 [PATCH 1/2] usb: typec: tcpm: free log buf memory when remove debug file jun.li
2019-07-17  8:06 ` [PATCH 2/2] usb: typec: tcpm: remove tcpm dir if no children jun.li
2019-07-17 13:33   ` Guenter Roeck
2019-07-17 13:32 ` [PATCH 1/2] usb: typec: tcpm: free log buf memory when remove debug file Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).