[U-Boot] [PATCH] pmic_i2c: Return error in case of invalid pmic_i2c_tx_num

Lukasz Majewski l.majewski at samsung.com
Mon Mar 19 16:57:19 CET 2012


On Fri, 16 Mar 2012 18:32:09 -0300
Fabio Estevam <festevam at gmail.com> wrote:

> Return error in case of invalid pmic_i2c_tx_num.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
> ---
>  drivers/misc/pmic_i2c.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/misc/pmic_i2c.c b/drivers/misc/pmic_i2c.c
> index ad55d64..ebb124d 100644
> --- a/drivers/misc/pmic_i2c.c
> +++ b/drivers/misc/pmic_i2c.c
> @@ -47,6 +47,9 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
>  	case 1:
>  		buf[0] = val & 0xff;
>  		break;
> +	default:
> +		printf("%s: invalid tx_num: %d", __func__,
> pmic_i2c_tx_num);
> +		return -1;
>  	}
>  
>  	if (i2c_write(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num))
> @@ -73,6 +76,9 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
>  	case 1:
>  		ret_val = buf[0];
>  		break;
> +	default:
> +		printf("%s: invalid tx_num: %d", __func__,
> pmic_i2c_tx_num);
> +		return -1;
>  	}
>  	memcpy(val, &ret_val, sizeof(ret_val));
>  

Hi Fabio,

Looks ok, for me.

Acked-by: Lukasz Majewski <l.majewski at samsung.com>
-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center
Platform Group


More information about the U-Boot mailing list