]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: cpu: Skip unavailable hart in the get_count() op
authorBin Meng <bmeng.cn@gmail.com>
Thu, 8 Aug 2019 07:52:08 +0000 (00:52 -0700)
committerAndes <uboot@andestech.com>
Tue, 3 Sep 2019 01:29:43 +0000 (09:29 +0800)
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>
drivers/cpu/riscv_cpu.c

index f77c12649964ddc048dd8985b2899e4a2180b210..28ad0aa30fdf0d20052f031a2313f5665a4d9c02 100644 (file)
@@ -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;