Re: [PATCH] wilc1000: use min() to make code cleaner

From: Kalle Valo
Date: Tue Dec 21 2021 - 13:13:37 EST


cgel.zte@xxxxxxxxx wrote:

> From: Changcheng Deng <deng.changcheng@xxxxxxxxxx>
>
> Use min() in order to make code cleaner.
>
> Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
> Signed-off-by: Changcheng Deng <deng.changcheng@xxxxxxxxxx>

Failed to compile:

In file included from ./include/linux/kernel.h:17,
from ./include/linux/clk.h:13,
from drivers/net/wireless/microchip/wilc1000/spi.c:7:
drivers/net/wireless/microchip/wilc1000/spi.c: In function 'wilc_spi_dma_rw':
./include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast [-Werror]
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
./include/linux/minmax.h:26:18: note: in expansion of macro '__typecheck'
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
./include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
./include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
drivers/net/wireless/microchip/wilc1000/spi.c:677:26: note: in expansion of macro 'min'
677 | nbytes = min(sz, DATA_PKT_SZ);
| ^~~
cc1: all warnings being treated as errors
make[5]: *** [scripts/Makefile.build:287: drivers/net/wireless/microchip/wilc1000/spi.o] Error 1
make[4]: *** [scripts/Makefile.build:549: drivers/net/wireless/microchip/wilc1000] Error 2
make[3]: *** [scripts/Makefile.build:549: drivers/net/wireless/microchip] Error 2
make[2]: *** [scripts/Makefile.build:549: drivers/net/wireless] Error 2
make[1]: *** [scripts/Makefile.build:549: drivers/net] Error 2
make: *** [Makefile:1846: drivers] Error 2

Patch set to Changes Requested.

--
https://patchwork.kernel.org/project/linux-wireless/patch/20211216091713.449841-1-deng.changcheng@xxxxxxxxxx/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches