diff options
author | Li Jun <jun.li@nxp.com> | 2019-07-17 11:06:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-30 12:04:09 +0300 |
commit | fd5da3e2cc61b4a7c877172fdc9348c82cf6ccfc (patch) | |
tree | 595c4c25897a0a1cdb72cc40a310bde1acd967c6 /drivers/usb | |
parent | 1957de95d425d1c06560069dc7277a73a8b28683 (diff) | |
download | linux-fd5da3e2cc61b4a7c877172fdc9348c82cf6ccfc.tar.xz |
usb: typec: tcpm: free log buf memory when remove debug file
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>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20190717080646.30421-1-jun.li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/typec/tcpm/tcpm.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 77f71f602f73..7b6497c1031e 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -587,6 +587,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); } |