CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Dmitry Torokhov CC: linux-input(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/input/joystick/adi.c:395:13-14: WARNING opportunity for min() Check for opencoded min(), max() implementations. Generated patches sometimes require adding a cast to fix compile warning. Warnings/patches scope intentionally limited to a function body. Generated by: scripts/coccinelle/misc/minmax.cocci CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 787af64d05cd528aac9ad16752d11bb1c6061bb9 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script :::::: branch date: 10 hours ago :::::: commit date: 11 months ago Please take the patch only if it's a positive warning. Thanks! drivers/input/joystick/adi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -392,7 +392,7 @@ static int adi_init_input(struct adi *ad if (!input_dev) return -ENOMEM; - t = adi->id < ADI_ID_MAX ? adi->id : ADI_ID_MAX; + t = min(adi->id, ADI_ID_MAX); snprintf(buf, ADI_MAX_PHYS_LENGTH, adi_names[t], adi->id); snprintf(adi->name, ADI_MAX_NAME_LENGTH, "Logitech %s [%s]", buf, adi->cname);