[U-Boot] [PATCH v3 06/15] cmd: cpu: ensure udevice is probed before calling cpu ops

Álvaro Fernández Rojas
2017-04-18T20:38:35Z

This causes exceptions for drivers that aren't probed when cpu ops are
requested.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
v3: add new patch to ensure that device is probed.

cmd/cpu.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/cmd/cpu.c b/cmd/cpu.c
index adfd54a..91f60c2 100644
--- a/cmd/cpu.c
+++ b/cmd/cpu.c
@@ -9,6 +9,7 @@
#include <command.h>
#include <cpu.h>
#include <dm.h>
+#include <dm/device-internal.h>
#include <errno.h>

static const char *cpu_feature_name[CPU_FEAT_COUNT] = {
@@ -36,6 +37,9 @@ static int print_cpu_list(bool detail)
bool first;
int i;

+ if (!device_active(dev) && device_probe(dev))
+ continue;
+
ret = cpu_get_desc(dev, buf, sizeof(buf));
printf("%3d: %-10s %s\n", dev->seq, dev->name,
ret ? "<no description>" : buf);
--
2.1.4