diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> | 2020-10-07 17:18:36 +0530 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-10-08 12:50:52 +1100 |
commit | fbf2f134c8c312d3166534a8bd6a1aaee6e9c7ef (patch) | |
tree | 9b5ab84cc24a519d2da33fb368f2075fe345c7f8 /arch/powerpc/platforms/pseries/hotplug-memory.c | |
parent | 950805f4d90eda14325ceab56b0f00d034baa8bc (diff) | |
download | linux-stable-fbf2f134c8c312d3166534a8bd6a1aaee6e9c7ef.tar.gz linux-stable-fbf2f134c8c312d3166534a8bd6a1aaee6e9c7ef.tar.bz2 linux-stable-fbf2f134c8c312d3166534a8bd6a1aaee6e9c7ef.zip |
powerpc/lmb-size: Use addr #size-cells value when fetching lmb-size
Make it consistent with other usages.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201007114836.282468-5-aneesh.kumar@linux.ibm.com
Diffstat (limited to 'arch/powerpc/platforms/pseries/hotplug-memory.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/hotplug-memory.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index ca5589a1ec7f..4e18653a3804 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -30,12 +30,17 @@ unsigned long pseries_memory_block_size(void) np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); if (np) { - const __be64 *size; + int len; + int size_cells; + const __be32 *prop; - size = of_get_property(np, "ibm,lmb-size", NULL); - if (size) - memblock_size = be64_to_cpup(size); + size_cells = of_n_size_cells(np); + + prop = of_get_property(np, "ibm,lmb-size", &len); + if (prop && len >= size_cells * sizeof(__be32)) + memblock_size = of_read_number(prop, size_cells); of_node_put(np); + } else if (machine_is(pseries)) { /* This fallback really only applies to pseries */ unsigned int memzero_size = 0; |