Skip to content

Commit fd5da3e

Browse files
Junlisuzhougregkh
authored andcommitted
usb: typec: tcpm: free log buf memory when remove debug file
The logbuffer memory should be freed when remove debug file. Cc: [email protected] # v4.15+ Fixes: 4b4e02c ("typec: tcpm: Move out of staging") Signed-off-by: Li Jun <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1957de9 commit fd5da3e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,15 @@ static void tcpm_debugfs_init(struct tcpm_port *port)
587587

588588
static void tcpm_debugfs_exit(struct tcpm_port *port)
589589
{
590+
int i;
591+
592+
mutex_lock(&port->logbuffer_lock);
593+
for (i = 0; i < LOG_BUFFER_ENTRIES; i++) {
594+
kfree(port->logbuffer[i]);
595+
port->logbuffer[i] = NULL;
596+
}
597+
mutex_unlock(&port->logbuffer_lock);
598+
590599
debugfs_remove(port->dentry);
591600
}
592601

0 commit comments

Comments
 (0)