diff options
author | Leonard Crestez <leonard.crestez@nxp.com> | 2017-02-14 17:31:03 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-12 06:37:25 +0100 |
commit | 5cc0cd0e3a5a73c2d54dfe8c0f79556ffb970af0 (patch) | |
tree | 7c25415c7974a7e5aac7bf1d90a6298cf01b7fb4 /drivers/regulator | |
parent | 272d60bfce0e8222d2b1fe479a98fdf3bf7e05d0 (diff) | |
download | linux-stable-5cc0cd0e3a5a73c2d54dfe8c0f79556ffb970af0.tar.gz linux-stable-5cc0cd0e3a5a73c2d54dfe8c0f79556ffb970af0.tar.bz2 linux-stable-5cc0cd0e3a5a73c2d54dfe8c0f79556ffb970af0.zip |
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.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 732ac71b82cd..88dbbeb8569b 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4273,12 +4273,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 == ®ulator_class) + if (consumer->dev && consumer->dev->class == ®ulator_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: |