diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2019-08-08 10:52:08 +0300 |
---|---|---|
committer | Andes <uboot@andestech.com> | 2019-09-03 04:29:43 +0300 |
commit | 4dfea4b5cd68b86dd47d1333f1871a402087deaa (patch) | |
tree | 6bc15ae519a7cf845843ea5be741241f42f4c60b /drivers/cpu | |
parent | d22c8be964a870f59d2fdab6c67cefa0c4799364 (diff) | |
download | u-boot-4dfea4b5cd68b86dd47d1333f1871a402087deaa.tar.xz |
riscv: cpu: Skip unavailable hart in the get_count() op
We should not count in hart that is marked as not available in the
device tree in riscv_cpu_get_count().
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Diffstat (limited to 'drivers/cpu')
-rw-r--r-- | drivers/cpu/riscv_cpu.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c index f77c126499..28ad0aa30f 100644 --- a/drivers/cpu/riscv_cpu.c +++ b/drivers/cpu/riscv_cpu.c @@ -46,6 +46,10 @@ static int riscv_cpu_get_count(struct udevice *dev) ofnode_for_each_subnode(node, dev_ofnode(dev->parent)) { const char *device_type; + /* skip if hart is marked as not available in the device tree */ + if (!ofnode_is_available(node)) + continue; + device_type = ofnode_read_string(node, "device_type"); if (!device_type) continue; |