msm:pm-8x60: Free memory on failure to add Kobject
CRs-fixed: 304135
Change-Id: Ifea4229d44a850898447fba485eac21b80bc099d
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
diff --git a/arch/arm/mach-msm/pm-8x60.c b/arch/arm/mach-msm/pm-8x60.c
index a929659..c831d4b 100644
--- a/arch/arm/mach-msm/pm-8x60.c
+++ b/arch/arm/mach-msm/pm-8x60.c
@@ -279,6 +279,12 @@
ret = 0;
mode_sysfs_add_cpu_exit:
+ if (!ret) {
+ if (mode && mode->kobj)
+ kobject_del(mode->kobj);
+ kfree(mode);
+ }
+
return ret;
}