aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorCedric Le Goater <clg@fr.ibm.com>2013-10-30 09:47:07 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-10-30 21:37:27 -0400
commit563c5d8af5d56739bc31f9f4b1c8a0994ed5742c (patch)
treed7b660b3d0edbf0b589f46205392dfd778f4c533 /arch/powerpc/platforms
parent65f36f4149ce4490b2174ef45e1dbe494f4b8268 (diff)
powerpc/nvram: Fix endian issue when reading the NVRAM size
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/chrp/nvram.c4
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/chrp/nvram.c b/arch/powerpc/platforms/chrp/nvram.c
index d3ceff04ffc7..9ef8cc3378d0 100644
--- a/arch/powerpc/platforms/chrp/nvram.c
+++ b/arch/powerpc/platforms/chrp/nvram.c
@@ -66,7 +66,7 @@ static void chrp_nvram_write(int addr, unsigned char val)
66void __init chrp_nvram_init(void) 66void __init chrp_nvram_init(void)
67{ 67{
68 struct device_node *nvram; 68 struct device_node *nvram;
69 const unsigned int *nbytes_p; 69 const __be32 *nbytes_p;
70 unsigned int proplen; 70 unsigned int proplen;
71 71
72 nvram = of_find_node_by_type(NULL, "nvram"); 72 nvram = of_find_node_by_type(NULL, "nvram");
@@ -79,7 +79,7 @@ void __init chrp_nvram_init(void)
79 return; 79 return;
80 } 80 }
81 81
82 nvram_size = *nbytes_p; 82 nvram_size = be32_to_cpup(nbytes_p);
83 83
84 printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size); 84 printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
85 of_node_put(nvram); 85 of_node_put(nvram);
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 2498d4d801e8..057fc894be51 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -804,7 +804,7 @@ machine_arch_initcall(pseries, pseries_nvram_init_log_partitions);
804int __init pSeries_nvram_init(void) 804int __init pSeries_nvram_init(void)
805{ 805{
806 struct device_node *nvram; 806 struct device_node *nvram;
807 const unsigned int *nbytes_p; 807 const __be32 *nbytes_p;
808 unsigned int proplen; 808 unsigned int proplen;
809 809
810 nvram = of_find_node_by_type(NULL, "nvram"); 810 nvram = of_find_node_by_type(NULL, "nvram");
@@ -817,7 +817,7 @@ int __init pSeries_nvram_init(void)
817 return -EIO; 817 return -EIO;
818 } 818 }
819 819
820 nvram_size = *nbytes_p; 820 nvram_size = be32_to_cpup(nbytes_p);
821 821
822 nvram_fetch = rtas_token("nvram-fetch"); 822 nvram_fetch = rtas_token("nvram-fetch");
823 nvram_store = rtas_token("nvram-store"); 823 nvram_store = rtas_token("nvram-store");