[U-Boot] [PATCH] board/BuR/kwb: fix usage of 'i2c_set_bus_speed'

Gerhard Sittig gsi at denx.de
Sat Mar 8 18:38:30 CET 2014


On Fri, Mar 07, 2014 at 18:56 +0100, Hannes Petermaier wrote:
> 
> - fix: return-value of 'i2c_set_bus_speed' was interpreted wrong
> 
> Signed-off-by: Hannes Petermaier <oe5hpm at oevsv.at>
> ---
>  board/BuR/kwb/board.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/board/BuR/kwb/board.c b/board/BuR/kwb/board.c
> index 8aa16bc..8fb5e68 100644
> --- a/board/BuR/kwb/board.c
> +++ b/board/BuR/kwb/board.c
> @@ -120,7 +120,7 @@ void am33xx_spl_board_init(void)
>  
>  	/* power-ON  3V3 via Resetcontroller */
>  	oldspeed = i2c_get_bus_speed();
> -	if (0 != i2c_set_bus_speed(CONFIG_SYS_OMAP24_I2C_SPEED_PSOC)) {
> +	if (0 <= i2c_set_bus_speed(CONFIG_SYS_OMAP24_I2C_SPEED_PSOC)) {
>  		buf = RSTCTRL_FORCE_PWR_NEN;
>  		i2c_write(RSTCTRL_ADDR, RSTCTRL_CTRLREG, 1,
>  			  (uint8_t *)&buf, sizeof(buf));

While you are at it, can you fixup this Yoda programming style
and use the regular idiom instead?  It hurts the brain to have to
stop and read code "backwards" before seeing what's going on.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de


More information about the U-Boot mailing list