From 8b075122ee84460496eef96f2099d00afab31f40 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Sat, 25 Nov 2017 12:09:28 +0530 Subject: [PATCH] staging: ccree: Remove a attribute group from a kobject All attribute group created during sys_init_dir() should be removed in sys_free_dir() Signed-off-by: Arvind Yadav Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ccree/ssi_sysfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c index 656215b34231..08858a4e9d24 100644 --- a/drivers/staging/ccree/ssi_sysfs.c +++ b/drivers/staging/ccree/ssi_sysfs.c @@ -162,8 +162,11 @@ static void sys_free_dir(struct sys_dir *sys_dir) kfree(sys_dir->sys_dir_attr_list); - if (sys_dir->sys_dir_kobj) + if (sys_dir->sys_dir_kobj) { + sysfs_remove_group(sys_dir->sys_dir_kobj, + &sys_dir->sys_dir_attr_group); kobject_put(sys_dir->sys_dir_kobj); + } } int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata)