[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211019152819.6141-1-clingutla@codeaurora.org>
Date: Tue, 19 Oct 2021 20:58:19 +0530
From: Lingutla Chandrasekhar <clingutla@...eaurora.org>
To: lukasz.luba@....com, rafael.j.wysocki@...el.com,
qperret@...gle.com, daniel.lezcano@...aro.org
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
Lingutla Chandrasekhar <clingutla@...eaurora.org>
Subject: [PATCH] PM: EM: do not allow pd creation prior to debugfs initialization
em_dev_register_perf_domain() can be called from any initcall level before
debugfs initialization, this allowed to create power domain debug entries
of the caller at unintended root_dir.
Fix it by not allowing creation of power domain debug entries, if root_dir
is not available.
Signed-off-by: Lingutla Chandrasekhar <clingutla@...eaurora.org>
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index a332ccd829e2..fe5a207d4023 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -68,6 +68,11 @@ static void em_debug_create_pd(struct device *dev)
struct dentry *d;
int i;
+ if (!rootdir) {
+ pr_err("EM: energy_model debug is not available yet\n");
+ return;
+ }
+
/* Create the directory of the performance domain */
d = debugfs_create_dir(dev_name(dev), rootdir);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
Powered by blists - more mailing lists