2015-06-11 09:16:25

by Cyrille Pitchen

[permalink] [raw]
Subject: [PATCH 0/1] i2c: at91: fix code checker warnings

ChangeLog

v1:
This patch fixes somes code checker warnings reported by Wolfram Sang:

drivers/i2c/busses/i2c-at91.c:213: style: Checking if unsigned variable 'buf_len' is less than zero.
drivers/i2c/busses/i2c-at91.c:254: style: Checking if unsigned variable 'buf_len' is less than zero.
drivers/i2c/busses/i2c-at91.c:293: style: Checking if unsigned variable 'buf_len' is less than zero.

Thanks for reporting!

Cyrille Pitchen (1):
i2c: at91: fix code checker warnings

drivers/i2c/busses/i2c-at91.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--
1.8.2.2


2015-06-11 09:16:46

by Cyrille Pitchen

[permalink] [raw]
Subject: [PATCH 1/1] i2c: at91: fix code checker warnings

buf_len is a size_t, so unsigned but was tested with '<= 0'.

Signed-off-by: Cyrille Pitchen <[email protected]>
---
drivers/i2c/busses/i2c-at91.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 0d2dc7d..967c0cb 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -232,7 +232,7 @@ static void at91_twi_dma_cleanup(struct at91_twi_dev *dev)

static void at91_twi_write_next_byte(struct at91_twi_dev *dev)
{
- if (dev->buf_len <= 0)
+ if (!dev->buf_len)
return;

/* 8bit write works with and without FIFO */
@@ -275,7 +275,7 @@ static void at91_twi_write_data_dma(struct at91_twi_dev *dev)
struct dma_chan *chan_tx = dma->chan_tx;
unsigned int sg_len = 1;

- if (dev->buf_len <= 0)
+ if (!dev->buf_len)
return;

dma->direction = DMA_TO_DEVICE;
@@ -347,7 +347,7 @@ error:

static void at91_twi_read_next_byte(struct at91_twi_dev *dev)
{
- if (dev->buf_len <= 0)
+ if (!dev->buf_len)
return;

/* 8bit read works with and without FIFO */
--
1.8.2.2

2015-06-11 09:26:36

by Cyrille Pitchen

[permalink] [raw]
Subject: Re: [PATCH 0/1] i2c: at91: fix code checker warnings

Hi all,

this patch was made after applying the previous series
"[PATCH v6 0/6] i2c: at91: add support to FIFOs and alternative command",
which was already accepted.

Best Regards,

Cyrille

Le 11/06/2015 11:16, Cyrille Pitchen a ?crit :
> ChangeLog
>
> v1:
> This patch fixes somes code checker warnings reported by Wolfram Sang:
>
> drivers/i2c/busses/i2c-at91.c:213: style: Checking if unsigned variable 'buf_len' is less than zero.
> drivers/i2c/busses/i2c-at91.c:254: style: Checking if unsigned variable 'buf_len' is less than zero.
> drivers/i2c/busses/i2c-at91.c:293: style: Checking if unsigned variable 'buf_len' is less than zero.
>
> Thanks for reporting!
>
> Cyrille Pitchen (1):
> i2c: at91: fix code checker warnings
>
> drivers/i2c/busses/i2c-at91.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>

2015-06-11 12:15:59

by Ludovic Desroches

[permalink] [raw]
Subject: Re: [PATCH 1/1] i2c: at91: fix code checker warnings

On Thu, Jun 11, 2015 at 11:16:32AM +0200, Cyrille Pitchen wrote:
> buf_len is a size_t, so unsigned but was tested with '<= 0'.
>
> Signed-off-by: Cyrille Pitchen <[email protected]>

Acked-by: Ludovic Desroches <[email protected]>

Thanks

> ---
> drivers/i2c/busses/i2c-at91.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 0d2dc7d..967c0cb 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -232,7 +232,7 @@ static void at91_twi_dma_cleanup(struct at91_twi_dev *dev)
>
> static void at91_twi_write_next_byte(struct at91_twi_dev *dev)
> {
> - if (dev->buf_len <= 0)
> + if (!dev->buf_len)
> return;
>
> /* 8bit write works with and without FIFO */
> @@ -275,7 +275,7 @@ static void at91_twi_write_data_dma(struct at91_twi_dev *dev)
> struct dma_chan *chan_tx = dma->chan_tx;
> unsigned int sg_len = 1;
>
> - if (dev->buf_len <= 0)
> + if (!dev->buf_len)
> return;
>
> dma->direction = DMA_TO_DEVICE;
> @@ -347,7 +347,7 @@ error:
>
> static void at91_twi_read_next_byte(struct at91_twi_dev *dev)
> {
> - if (dev->buf_len <= 0)
> + if (!dev->buf_len)
> return;
>
> /* 8bit read works with and without FIFO */
> --
> 1.8.2.2
>

2015-06-11 13:18:53

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 1/1] i2c: at91: fix code checker warnings

On Thu, Jun 11, 2015 at 11:16:32AM +0200, Cyrille Pitchen wrote:
> buf_len is a size_t, so unsigned but was tested with '<= 0'.
>
> Signed-off-by: Cyrille Pitchen <[email protected]>

Applied to for-next, thanks!


Attachments:
(No filename) (223.00 B)
signature.asc (819.00 B)
Digital signature
Download all attachments