[PATCH] pinctrl: paris: fix check on EINT_NA comparison

Colin Ian King colin.king at canonical.com
Tue Sep 25 08:02:48 PDT 2018


On 25/09/18 15:58, Dan Carpenter wrote:
> On Tue, Sep 25, 2018 at 02:21:30PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king at canonical.com>
>>
>> Currently, the check on desc->eint.eint_n == EINT_NA is always false
>> because this is comparing a u16 to -1 which can never be true.  Fix
>> this by casting EINT_NA to u16.
>>
>> Fixes: fb5fa8dc151b ("pinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.c")
>> Signed-off-by: Colin Ian King <colin.king at canonical.com>
>> ---
>>  drivers/pinctrl/mediatek/pinctrl-paris.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
>> index 4cf0fea30b7d..77d380145dfd 100644
>> --- a/drivers/pinctrl/mediatek/pinctrl-paris.c
>> +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
>> @@ -729,7 +729,7 @@ static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
>>  
>>  	desc = (const struct mtk_pin_desc *)&hw->soc->pins[offset];
>>  
>> -	if (desc->eint.eint_n == EINT_NA)
>> +	if (desc->eint.eint_n == (u16)EINT_NA)
> 
> Adding casts is ugly...  I reported this earlier and think Sean Wang is
> going to send a fix for it.

Fair enough. Thanks for letting me know.

> 
> regards,
> dan carpenter
> 




More information about the linux-arm-kernel mailing list