From: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Date: Mon, 1 Dec 2014 19:49:18 +0000 (+1300)
Subject: i2c: Fix deselection of muxes
X-Git-Tag: v2025.01-rc5-pxa1908~14177^2~1
X-Git-Url: http://git.dujemihanovic.xyz/html/static/git-logo.png?a=commitdiff_plain;h=2fe50ef4034b69b45413108dd3e736de2548c04a;p=u-boot.git

i2c: Fix deselection of muxes

Due to an uninitialised variable, when muxes were deselected, any value
could be written to the mux control register. On the PCA9548, this could
result in multiple channels being selected, thus enabling multiple
pull-up resistors, and much bus capacitance.

The fix is simply to initialise the written value to zero.

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
---

diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index d34b749a56..4539667eae 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -178,7 +178,7 @@ static int i2c_mux_disconnet_all(void)
 {
 	struct	i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
 	int	i;
-	uint8_t	buf;
+	uint8_t	buf = 0;
 
 	if (I2C_ADAP->init_done == 0)
 		return 0;