mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Gerlach <d-gerlach@ti.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Kevin Hilman <khilman@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	Thara Gopinath <thara.gopinath@linaro.org>,
	Dave Gerlach <d-gerlach@ti.com>
Subject: [PATCH] PM / Domains: Ensure genpd name is set before creating debugfs entry
Date: Fri, 28 Jul 2017 13:48:18 -0500	[thread overview]
Message-ID: <20170728184818.1306-1-d-gerlach@ti.com> (raw)

Commit b6a1d093f96b ("PM / Domains: Extend generic power domain
debugfs") extends the existing generic power domain debugfs to provide
more information about each genpd, however it creates a debugfs
directory for each based on the name of the genpd. While it is a good
idea to populate the name field of each genpd, up until this commit it
was not required. However, attempting to call debugfs_create_dir with a
null name value causes a NULL pointer dereference panic.

In order to keep things working as they did before the aforementioned
patch, check to see if name has been populated and if not, skip creating
the extended debugfs info path and warn that name is needed to get this
extended info.

Fixes: b6a1d093f96b ("PM / Domains: Extend generic power domain debugfs")
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
---
 drivers/base/power/domain.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 43fd08e50ae9..77f7ea6f7fc3 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2575,6 +2575,12 @@ static int __init pm_genpd_debug_init(void)
 		return -ENOMEM;
 
 	list_for_each_entry(genpd, &gpd_list, gpd_list_node) {
+		if (!genpd->name) {
+			pr_warn("%s: Must populate name of genpd for extended debugfs info.",
+				__func__);
+			continue;
+		}
+
 		d = debugfs_create_dir(genpd->name, pm_genpd_debugfs_dir);
 		if (!d)
 			return -ENOMEM;
-- 
2.13.0

             reply	other threads:[~2017-07-28 18:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 18:48 Dave Gerlach [this message]
2017-07-28 18:55 ` Dave Gerlach
2017-07-29  8:04   ` Ulf Hansson

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=20170728184818.1306-1-d-gerlach@ti.com \
    --to=d-gerlach@ti.com \
    --cc=khilman@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=thara.gopinath@linaro.org \
    --cc=ulf.hansson@linaro.org \
    /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

all inboxes | Powered by JetHome®