]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc/nvram: Fix endian issue when reading the NVRAM size
authorCedric Le Goater <clg@fr.ibm.com>
Wed, 30 Oct 2013 13:47:07 +0000 (14:47 +0100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 31 Oct 2013 01:37:27 +0000 (12:37 +1100)
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/chrp/nvram.c
arch/powerpc/platforms/pseries/nvram.c

index d3ceff04ffc79c6832b8b96087913e4fa02692e0..9ef8cc3378d0dae581ba8abd19a21bcf6f63a266 100644 (file)
@@ -66,7 +66,7 @@ static void chrp_nvram_write(int addr, unsigned char val)
 void __init chrp_nvram_init(void)
 {
        struct device_node *nvram;
-       const unsigned int *nbytes_p;
+       const __be32 *nbytes_p;
        unsigned int proplen;
 
        nvram = of_find_node_by_type(NULL, "nvram");
@@ -79,7 +79,7 @@ void __init chrp_nvram_init(void)
                return;
        }
 
-       nvram_size = *nbytes_p;
+       nvram_size = be32_to_cpup(nbytes_p);
 
        printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
        of_node_put(nvram);
index 2498d4d801e8d0a6ca09c5875f9d20260a4cc2a6..057fc894be511342da4c914d28113b73a44752c0 100644 (file)
@@ -804,7 +804,7 @@ machine_arch_initcall(pseries, pseries_nvram_init_log_partitions);
 int __init pSeries_nvram_init(void)
 {
        struct device_node *nvram;
-       const unsigned int *nbytes_p;
+       const __be32 *nbytes_p;
        unsigned int proplen;
 
        nvram = of_find_node_by_type(NULL, "nvram");
@@ -817,7 +817,7 @@ int __init pSeries_nvram_init(void)
                return -EIO;
        }
 
-       nvram_size = *nbytes_p;
+       nvram_size = be32_to_cpup(nbytes_p);
 
        nvram_fetch = rtas_token("nvram-fetch");
        nvram_store = rtas_token("nvram-store");