Skip to content

Commit 12ca729

Browse files
Junlisuzhougregkh
authored andcommitted
usb: typec: tcpm: remove tcpm dir if no children
If config tcpm as module, module unload will not remove tcpm dir, then the next module load will have problem: the rootdir is NULL but tcpm dir is still there, so tcpm_debugfs_init() will create tcpm dir again with failure, fix it by remove the tcpm dir if no children. 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 fd5da3e commit 12ca729

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,10 @@ static void tcpm_debugfs_exit(struct tcpm_port *port)
597597
mutex_unlock(&port->logbuffer_lock);
598598

599599
debugfs_remove(port->dentry);
600+
if (list_empty(&rootdir->d_subdirs)) {
601+
debugfs_remove(rootdir);
602+
rootdir = NULL;
603+
}
600604
}
601605

602606
#else

0 commit comments

Comments
 (0)