public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lingutla Chandrasekhar <clingutla@codeaurora.org>
To: lukasz.luba@arm.com, rafael.j.wysocki@intel.com,
	qperret@google.com, daniel.lezcano@linaro.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Lingutla Chandrasekhar <clingutla@codeaurora.org>
Subject: [PATCH] PM: EM: do not allow pd creation prior to debugfs initialization
Date: Tue, 19 Oct 2021 20:58:19 +0530	[thread overview]
Message-ID: <20211019152819.6141-1-clingutla@codeaurora.org> (raw)

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@codeaurora.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.


             reply	other threads:[~2021-10-19 15:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 15:28 Lingutla Chandrasekhar [this message]
2021-10-19 17:05 ` [PATCH] PM: EM: do not allow pd creation prior to debugfs initialization Lukasz Luba
2021-10-20 12:03   ` Chandrasekhar L
2021-10-20 12:54     ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019152819.6141-1-clingutla@codeaurora.org \
    --to=clingutla@codeaurora.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=qperret@google.com \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox