If kzalloc() fails in smsdvb_debugfs_create(), the dir and file which is created by debugfs_create_dir() and debugfs_create_file() is not freed. So use debugfs_remove_recursive() to free them. Fixes: 503efe5cfc9f ("[media] siano: split debugfs code into a separate file") Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> --- drivers/media/common/siano/smsdvb-debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c index 16d3b9ab31c5..38b25e88ce57 100644 --- a/drivers/media/common/siano/smsdvb-debugfs.c +++ b/drivers/media/common/siano/smsdvb-debugfs.c @@ -375,8 +375,10 @@ int smsdvb_debugfs_create(struct smsdvb_client_t *client) } debug_data = kzalloc(sizeof(*client->debug_data), GFP_KERNEL); - if (!debug_data) + if (!debug_data) { + debugfs_remove_recursive(client->debugfs); return -ENOMEM; + } client->debug_data = debug_data; client->prt_dvb_stats = smsdvb_print_dvb_stats; -- 2.34.1