Commit da1324e7 authored by Leonard Crestez's avatar Leonard Crestez Committed by Sasha Levin

regulator: Fix regulator_summary for deviceless consumers

[ Upstream commit e42a46b6 ]

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: default avatarLeonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 01f97343
...@@ -4028,12 +4028,13 @@ static void regulator_summary_show_subtree(struct seq_file *s, ...@@ -4028,12 +4028,13 @@ static void regulator_summary_show_subtree(struct seq_file *s,
seq_puts(s, "\n"); seq_puts(s, "\n");
list_for_each_entry(consumer, &rdev->consumer_list, list) { list_for_each_entry(consumer, &rdev->consumer_list, list) {
if (consumer->dev->class == &regulator_class) if (consumer->dev && consumer->dev->class == &regulator_class)
continue; continue;
seq_printf(s, "%*s%-*s ", seq_printf(s, "%*s%-*s ",
(level + 1) * 3 + 1, "", (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) { switch (rdev->desc->type) {
case REGULATOR_VOLTAGE: case REGULATOR_VOLTAGE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment