summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2017-02-14 18:31:03 +0300
committerMark Brown <broonie@kernel.org>2017-02-16 15:44:58 +0300
commite42a46b6f52473661ad192f76a128a68fe301df4 (patch)
tree7acfe205c917b10dbf77f3616cb6f5f4de6d37e0 /drivers/regulator
parentd00b74613fb18dfd0a5aa99270ee2e72d5c808d7 (diff)
downloadlinux-e42a46b6f52473661ad192f76a128a68fe301df4.tar.xz
regulator: Fix regulator_summary for deviceless consumers
It is allowed to call regulator_get with a NULL dev argument (_regulator_get explicitly checks for it) but this causes an error later when printing /sys/kernel/debug/regulator_summary. Fix this by explicitly handling "deviceless" consumers in the debugfs code. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 04baac9a165b..66319542baa6 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4391,12 +4391,13 @@ static void regulator_summary_show_subtree(struct seq_file *s,
seq_puts(s, "\n");
list_for_each_entry(consumer, &rdev->consumer_list, list) {
- if (consumer->dev->class == &regulator_class)
+ if (consumer->dev && consumer->dev->class == &regulator_class)
continue;
seq_printf(s, "%*s%-*s ",
(level + 1) * 3 + 1, "",
- 30 - (level + 1) * 3, dev_name(consumer->dev));
+ 30 - (level + 1) * 3,
+ consumer->dev ? dev_name(consumer->dev) : "deviceless");
switch (rdev->desc->type) {
case REGULATOR_VOLTAGE: