Commit 563c5d8a authored by Cedric Le Goater's avatar Cedric Le Goater Committed by Benjamin Herrenschmidt

powerpc/nvram: Fix endian issue when reading the NVRAM size

Signed-off-by: default avatarCedric Le Goater <clg@fr.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 65f36f41
...@@ -66,7 +66,7 @@ static void chrp_nvram_write(int addr, unsigned char val) ...@@ -66,7 +66,7 @@ static void chrp_nvram_write(int addr, unsigned char val)
void __init chrp_nvram_init(void) void __init chrp_nvram_init(void)
{ {
struct device_node *nvram; struct device_node *nvram;
const unsigned int *nbytes_p; const __be32 *nbytes_p;
unsigned int proplen; unsigned int proplen;
nvram = of_find_node_by_type(NULL, "nvram"); nvram = of_find_node_by_type(NULL, "nvram");
...@@ -79,7 +79,7 @@ void __init chrp_nvram_init(void) ...@@ -79,7 +79,7 @@ void __init chrp_nvram_init(void)
return; return;
} }
nvram_size = *nbytes_p; nvram_size = be32_to_cpup(nbytes_p);
printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size); printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
of_node_put(nvram); of_node_put(nvram);
......
...@@ -804,7 +804,7 @@ machine_arch_initcall(pseries, pseries_nvram_init_log_partitions); ...@@ -804,7 +804,7 @@ machine_arch_initcall(pseries, pseries_nvram_init_log_partitions);
int __init pSeries_nvram_init(void) int __init pSeries_nvram_init(void)
{ {
struct device_node *nvram; struct device_node *nvram;
const unsigned int *nbytes_p; const __be32 *nbytes_p;
unsigned int proplen; unsigned int proplen;
nvram = of_find_node_by_type(NULL, "nvram"); nvram = of_find_node_by_type(NULL, "nvram");
...@@ -817,7 +817,7 @@ int __init pSeries_nvram_init(void) ...@@ -817,7 +817,7 @@ int __init pSeries_nvram_init(void)
return -EIO; return -EIO;
} }
nvram_size = *nbytes_p; nvram_size = be32_to_cpup(nbytes_p);
nvram_fetch = rtas_token("nvram-fetch"); nvram_fetch = rtas_token("nvram-fetch");
nvram_store = rtas_token("nvram-store"); nvram_store = rtas_token("nvram-store");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment