]> git.sur5r.net Git - u-boot/commitdiff
i2c: i2c-uclass-compat: avoid any BSS usage
authorVignesh R <vigneshr@ti.com>
Mon, 25 Jul 2016 10:56:45 +0000 (16:26 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 8 Aug 2016 17:33:00 +0000 (13:33 -0400)
As I2C can be used before DRAM initialization for reading EEPROM,
avoid using static variables stored in BSS, since BSS is in DRAM, which
may not have been initialised yet. Explicitly mark "static global"
variables as belonging to the .data section.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Heiko Schocher<hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/i2c/i2c-uclass-compat.c

index 5606d1f807f64dead14b8ba65a66cfc4f3852b08..de78db6a887f3a4bc74a0486e2ee634c98775057 100644 (file)
@@ -9,7 +9,7 @@
 #include <errno.h>
 #include <i2c.h>
 
-static int cur_busnum;
+static int cur_busnum __attribute__((section(".data")));
 
 static int i2c_compat_get_device(uint chip_addr, int alen,
                                 struct udevice **devp)