• Lee Jones's avatar
    mfd: ab3100-core: Fix incompatible types in comparison expression warning · 54daa5d4
    Lee Jones authored
    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: default avatarLee Jones <lee.jones@linaro.org>
    54daa5d4
ab3100-core.c 20.2 KB