Numeric values in properties can be unaligned, so introduce get_unaligned() in of_read_number() to make this work correctly on all processors.
Signed-off-by: David VomLehn <[email protected]> --- include/linux/of.h | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/of.h b/include/linux/of.h index cad7cf0..a0a6925 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -22,6 +22,7 @@ #include <linux/spinlock.h> #include <asm/byteorder.h> +#include <asm/unaligned.h> #ifdef CONFIG_OF @@ -110,8 +111,11 @@ extern void of_node_put(struct device_node *node); static inline u64 of_read_number(const __be32 *cell, int size) { u64 r = 0; - while (size--) - r = (r << 32) | be32_to_cpu(*(cell++)); + while (size--) { + r = (r << 32) | be32_to_cpu(get_unaligned(cell)); + cell++; + } + return r; } _______________________________________________ devicetree-discuss mailing list [email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
