[U-Boot] [PATCH] i2c: i2c_cdns: Fix below warnings with checker tool

Heiko Schocher hs at denx.de
Thu Mar 21 03:50:57 UTC 2019


Hello Michal,

Am 14.03.2019 um 09:18 schrieb Michal Simek:
> From: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>
> 
> This patch fixes below warnings found with checker tool.
> The variable len in i2c_msg struct is of unsigned type
> and it is received as recv_count which is unsigned type
> but it is checked with < 0 which is always false, hence
> removed it.
> The local variable curr_recv_count is declared as signed
> type and compared aginst unsigned recv_count which is
> incorrect. This is fixed by declaring it as unsigned type.
> 
> drivers/i2c/i2c-cdns.c: In function ‘cdns_i2c_read_data’:
> drivers/i2c/i2c-cdns.c:317:18: warning: comparison of
> unsigned expression < 0 is always false [-Wtype-limits]
>    if ((recv_count < 0))
>                    ^
> drivers/i2c/i2c-cdns.c:340:24: warning: comparison of
> integer expressions of different signedness:
> ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
>    updatetx = recv_count > curr_recv_count;
>                          ^
> drivers/i2c/i2c-cdns.c:361:39: warning: comparison of
> integer expressions of different signedness:
> ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
>      while (readl(&regs->transfer_size) !=
> 
> Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
> 
>   drivers/i2c/i2c-cdns.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)

Thanks!

Reviewed-by: Heiko Schocher <hs at denx.de>

Hmm.. this patch is assigned to you ... do you want to pick it up,
or should I ?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list