]> git.baikalelectronics.ru Git - kernel.git/commit
mfd: ab3100-core: Fix incompatible types in comparison expression warning
authorLee Jones <lee.jones@linaro.org>
Tue, 23 Jun 2020 09:26:11 +0000 (10:26 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 6 Jul 2020 07:31:55 +0000 (08:31 +0100)
commit1f8ba290006d1f05ba5aea62b9b15a60b8a74cec
treeb752290f23da26ee8960d2c2c1bc4826ca32ff84
parent4fbcb21af18521bc78c157eaa7f4cf6e3f8ae014
mfd: ab3100-core: Fix incompatible types in comparison expression warning

Smatch reports:

 drivers/mfd/ab3100-core.c:501:20: error: incompatible types in comparison expression (different type sizes):
 drivers/mfd/ab3100-core.c:501:20:    unsigned int *
 drivers/mfd/ab3100-core.c:501:20:    unsigned long *
 drivers/mfd/ab8500-debugfs.c:1804:20: error: incompatible types in comparison expression (different type sizes):
 drivers/mfd/ab8500-debugfs.c:1804:20:    unsigned int *
 drivers/mfd/ab8500-debugfs.c:1804:20:    unsigned long *

Since the second min() argument can be less than 0 a signed
variable is required for assignment.  However, the non-sized
type size_t is passed in from the userspace handlers.  In order
to firstly compare, then assign the smallest value, we firstly
need to cast them both to the same as the receiving size_t typed
variable.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/ab3100-core.c