Patchwork [U-Boot] Fix: nommu I2C adapter relocation error

login
register
mail settings
Submitter esw@bus-elektronik.de
Date Oct. 14, 2013, 8:27 a.m.
Message ID <1381739258-10011-1-git-send-email-esw@bus-elektronik.de>
Download mbox | patch
Permalink /patch/283152/
State Awaiting Upstream
Delegated to: Heiko Schocher
Headers show

Comments

esw@bus-elektronik.de - Oct. 14, 2013, 8:27 a.m.
From: "Jens Scharsig (BuS Elektronik)" <esw@bus-elektronik.de>

NoMMU systems have a access violation problem with i2c_reloc_fixup.
Blame for it is a double relocation of the adapter itself. The
i2c_adap_p is already relocated, if i2c_reloc_fixup is called.
This patch removes the relocation of i2c_adap_p from i2c_reloc_fixup
to fix this.

Signed-off-by: Jens Scharsig (BuS Elektronik) <esw@bus-elektronik.de>
---
 drivers/i2c/i2c_core.c | 4 ----
 1 file changed, 4 deletions(-)
Heiko Schocher - Oct. 17, 2013, 6:22 a.m.
Hello Jens,

Am 14.10.2013 10:27, schrieb Jens Scharsig (BuS Elektronik):
> From: "Jens Scharsig (BuS Elektronik)"<esw@bus-elektronik.de>
>
> NoMMU systems have a access violation problem with i2c_reloc_fixup.
> Blame for it is a double relocation of the adapter itself. The
> i2c_adap_p is already relocated, if i2c_reloc_fixup is called.
> This patch removes the relocation of i2c_adap_p from i2c_reloc_fixup
> to fix this.
>
> Signed-off-by: Jens Scharsig (BuS Elektronik)<esw@bus-elektronik.de>
> ---
>   drivers/i2c/i2c_core.c | 4 ----
>   1 file changed, 4 deletions(-)

Applied to u-boot-i2c.git

Thanks!

bye,
Heiko

Patch

diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index d1072e8..bb5d4db 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -53,10 +53,6 @@  void i2c_reloc_fixup(void)
 		return;
 
 	for (i = 0; i < max; i++) {
-		/* adapter itself */
-		addr = (unsigned long)i2c_adap_p;
-		addr += gd->reloc_off;
-		i2c_adap_p = (struct i2c_adapter *)addr;
 		/* i2c_init() */
 		addr = (unsigned long)i2c_adap_p->init;
 		addr += gd->reloc_off;