Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd5da3e2 authored by Li Jun's avatar Li Jun Committed by Greg Kroah-Hartman
Browse files

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: 4b4e02c8 ("typec: tcpm: Move out of staging")
Signed-off-by: default avatarLi Jun <jun.li@nxp.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20190717080646.30421-1-jun.li@nxp.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1957de95
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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);
}