diff mbox

[U-Boot,1/2] i2c: Fix deselection of muxes

Message ID 1417463359-3796-1-git-send-email-mark.tomlinson@alliedtelesis.co.nz
State Awaiting Upstream
Delegated to: Heiko Schocher
Headers show

Commit Message

Mark Tomlinson Dec. 1, 2014, 7:49 p.m. UTC
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>
---
 drivers/i2c/i2c_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chris Packham Dec. 3, 2014, 7:35 a.m. UTC | #1
Hi Mark,

This might get more attention if Heiko was on the Cc list.

On Tue, Dec 2, 2014 at 8:49 AM, Mark Tomlinson
<mark.tomlinson@alliedtelesis.co.nz> wrote:
> 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>
> ---
>  drivers/i2c/i2c_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
> index d34b749..4539667 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;
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index d34b749..4539667 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;