]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/of/base.c
of: Fix iteration bug over CPU reg properties
[karo-tx-linux.git] / drivers / of / base.c
index e4c99453adf158a0043ff630667b1a0b3bc2d421..3ae106d8979149e57fb1bce2cab413191014da39 100644 (file)
@@ -265,9 +265,9 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun,
 
        ac = of_n_addr_cells(cpun);
        cell = of_get_property(cpun, prop_name, &prop_len);
-       if (!cell)
+       if (!cell || !ac)
                return false;
-       prop_len /= sizeof(*cell);
+       prop_len /= sizeof(*cell) * ac;
        for (tid = 0; tid < prop_len; tid++) {
                hwid = of_read_number(cell, ac);
                if (arch_match_cpu_phys_id(cpu, hwid)) {