From: Vignesh R Date: Mon, 25 Jul 2016 10:56:45 +0000 (+0530) Subject: i2c: i2c-uclass-compat: avoid any BSS usage X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=95def3cf5d24aebbcdffe6c4fc1a39288cf00b6a;p=u-boot.git i2c: i2c-uclass-compat: avoid any BSS usage 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 Acked-by: Heiko Schocher Reviewed-by: Simon Glass --- diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c index 5606d1f807..de78db6a88 100644 --- a/drivers/i2c/i2c-uclass-compat.c +++ b/drivers/i2c/i2c-uclass-compat.c @@ -9,7 +9,7 @@ #include #include -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)