aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2017-02-14 10:31:03 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-12 00:41:43 -0500
commit2f714ba1282aa6f5f0158329a1b2d3858698618c (patch)
treef0c63de54cadd3b72d7fa6835e88b92de44399b8 /drivers/regulator
parent59cd503c8cfd3f69f8126165b274860bbbd058db (diff)
regulator: Fix regulator_summary for deviceless consumers
commit e42a46b6f52473661ad192f76a128a68fe301df4 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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 5c1519b229e0..9faccfceb53c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4357,12 +4357,13 @@ static void regulator_summary_show_subtree(struct seq_file *s,
4357 seq_puts(s, "\n"); 4357 seq_puts(s, "\n");
4358 4358
4359 list_for_each_entry(consumer, &rdev->consumer_list, list) { 4359 list_for_each_entry(consumer, &rdev->consumer_list, list) {
4360 if (consumer->dev->class == &regulator_class) 4360 if (consumer->dev && consumer->dev->class == &regulator_class)
4361 continue; 4361 continue;
4362 4362
4363 seq_printf(s, "%*s%-*s ", 4363 seq_printf(s, "%*s%-*s ",
4364 (level + 1) * 3 + 1, "", 4364 (level + 1) * 3 + 1, "",
4365 30 - (level + 1) * 3, dev_name(consumer->dev)); 4365 30 - (level + 1) * 3,
4366 consumer->dev ? dev_name(consumer->dev) : "deviceless");
4366 4367
4367 switch (rdev->desc->type) { 4368 switch (rdev->desc->type) {
4368 case REGULATOR_VOLTAGE: 4369 case REGULATOR_VOLTAGE: