[PATCH 6/7] i2c: at91: fix invalid length check
Bo Shen
voice.shen at atmel.com
Mon Oct 20 19:01:10 PDT 2014
Hi Lucas,
On 10/21/2014 02:16 AM, Lucas Stach wrote:
> Signed-off-by: Lucas Stach <dev at lynxeye.de>
Acked-by: Bo Shen <voice.shen at atmel.com>
> ---
> drivers/i2c/busses/i2c-at91.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index deb4ea4..3a644cf 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -140,7 +140,7 @@ static void at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk)
>
> static void at91_twi_write_next_byte(struct at91_twi_dev *dev)
> {
> - if (dev->buf_len <= 0)
> + if (!dev->buf_len)
> return;
>
> at91_twi_write(dev, AT91_TWI_THR, *dev->buf);
> @@ -156,7 +156,7 @@ static void at91_twi_write_next_byte(struct at91_twi_dev *dev)
>
> static void at91_twi_read_next_byte(struct at91_twi_dev *dev)
> {
> - if (dev->buf_len <= 0)
> + if (!dev->buf_len)
> return;
>
> *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff;
>
Best Regards,
Bo Shen
More information about the barebox
mailing list