]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: mvebu: don't dereference null bd pointer
authorChris Packham <judge.packham@gmail.com>
Tue, 22 Oct 2019 07:05:25 +0000 (20:05 +1300)
committerStefan Roese <sr@denx.de>
Thu, 14 Nov 2019 07:28:39 +0000 (08:28 +0100)
As mentioned in doc/README.arm-relocation gd->bd is not available in
dram_init() so we shouldn't attempt to access it.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/mach-mvebu/dram.c

index fa8c799a462e0c3f0c513bc5b7598973f8b5e6ab..ba8ebc62887fe21abb469f4ab880506f740be71f 100644 (file)
@@ -281,16 +281,6 @@ int dram_init(void)
                        size = MVEBU_SDRAM_SIZE_MAX;
        }
 
-       for (; i < CONFIG_NR_DRAM_BANKS; i++) {
-               /* If above loop terminated prematurely, we need to set
-                * remaining banks' start address & size as 0. Otherwise other
-                * u-boot functions and Linux kernel gets wrong values which
-                * could result in crash */
-               gd->bd->bi_dram[i].start = 0;
-               gd->bd->bi_dram[i].size = 0;
-       }
-
-
        if (ecc_enabled())
                dram_ecc_scrubbing();