From c8c84859429910a1c55e379d3e458e2d1c8eb73e Mon Sep 17 00:00:00 2001 From: Santosh Mardi Date: Thu, 8 Oct 2020 13:08:48 +0530 Subject: [PATCH] drivers: soc: qcom: avoid double initialization of kobj In rimps_memlat driver the rimps_kobj is initialized twice once while creating and another while initializing and adding to the parent kobj, which resulted in kernel warning. Fix the double initialization of rimps_kobj. Change-Id: I95c03d83f63cffd506b2f3ee36f1a6da9f4f1d31 Signed-off-by: Santosh Mardi --- drivers/soc/qcom/rimps_memlat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/rimps_memlat.c b/drivers/soc/qcom/rimps_memlat.c index 78dba2de7939..43c34558e8fc 100644 --- a/drivers/soc/qcom/rimps_memlat.c +++ b/drivers/soc/qcom/rimps_memlat.c @@ -1255,10 +1255,13 @@ static int memlat_cpu_grp_probe(struct platform_device *pdev) } if (!rimps_kobj) { - rimps_kobj = kobject_create(); - if (!rimps_kobj) + rimps_kobj = kzalloc(sizeof(*rimps_kobj), GFP_KERNEL); + + if (!rimps_kobj) { dev_err(dev, "%s: failed to create rimps_kobj\n", __func__); + return -ENOMEM; + } ret = kobject_init_and_add(rimps_kobj, &ktype_log_level, &cpu_subsys.dev_root->kobj, "memlat");