[U-Boot] [PATCH 2/2] x86: i2c: Avoid using BSS before it is available

Simon Glass sjg at chromium.org
Sat Aug 6 05:35:28 CEST 2016


If intel_i2c_bind() is called before relocation there is no BSS section
available. Use the data section instead, which is always available.

A better fix might be to use global_data, perhaps a new member in
x86's struct arch_global_data. Comments welcome.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/i2c/intel_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/intel_i2c.c b/drivers/i2c/intel_i2c.c
index 5b7953a..01badf2 100644
--- a/drivers/i2c/intel_i2c.c
+++ b/drivers/i2c/intel_i2c.c
@@ -289,7 +289,7 @@ static int intel_i2c_probe(struct udevice *dev)
 
 static int intel_i2c_bind(struct udevice *dev)
 {
-	static int num_cards;
+	static int num_cards __attribute__ ((section(".data")));
 	char name[20];
 
 	/* Create a unique device name for PCI type devices */
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list