The early_init_dt_scan_acpi() function currently uses be32_to_cpu() helpers to read the "linux,acpi-start" and "linux,acpi-len" properties. This may not be safe for arm64. This patch uses of_read_ulong to read the property values which should be safe for both arm and arm64.
Signed-off-by: Mark Salter msalter@redhat.com --- drivers/of/fdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 875a4c1..d48ab6a 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -720,13 +720,13 @@ int __init early_init_dt_scan_acpi(unsigned long node, const char *uname, /* Retrieve acpi,address line */ pinfo = (struct acpi_arm_root *)data; p = of_get_flat_dt_prop(node, "linux,acpi-start", &l); - if (p != NULL && l > 0) - pinfo->phys_address = be32_to_cpu(*p); + if (p) + pinfo->phys_address = of_read_ulong(p, l/4);
/* Retrieve acpi,size line */ p = of_get_flat_dt_prop(node, "linux,acpi-len", &l); - if (p != NULL && l > 0) - pinfo->size = be32_to_cpu(*p); + if (p) + pinfo->size = of_read_ulong(p, l/4);
return 1; }
On 08/26/2013 07:25 PM, Mark Salter wrote:
The early_init_dt_scan_acpi() function currently uses be32_to_cpu() helpers to read the "linux,acpi-start" and "linux,acpi-len" properties. This may not be safe for arm64. This patch uses of_read_ulong to read the property values which should be safe for both arm and arm64.
Signed-off-by: Mark Salter msalter@redhat.com
drivers/of/fdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 875a4c1..d48ab6a 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -720,13 +720,13 @@ int __init early_init_dt_scan_acpi(unsigned long node, const char *uname, /* Retrieve acpi,address line */ pinfo = (struct acpi_arm_root *)data; p = of_get_flat_dt_prop(node, "linux,acpi-start", &l);
- if (p != NULL && l > 0)
pinfo->phys_address = be32_to_cpu(*p);
if (p)
pinfo->phys_address = of_read_ulong(p, l/4);
/* Retrieve acpi,size line */ p = of_get_flat_dt_prop(node, "linux,acpi-len", &l);
- if (p != NULL && l > 0)
pinfo->size = be32_to_cpu(*p);
if (p)
pinfo->size = of_read_ulong(p, l/4);
return 1; }
Acked-by: Al Stone al.stone@linaro.org