Re: [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check on unsigned int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/01/17 15:45, Rob Herring wrote:
> On Fri, Jan 13, 2017 at 3:06 PM, Colin King <colin.king@xxxxxxxxxxxxx> wrote:
>> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>>
>> pin is an unsigned int and therefore can never be < 0 so
>> this check is redundant. Remove the check and the associated
>> dev_err error message.
> 
> Not sure why I got copied on this...
> 
>> Fixes CoverityScan CID#1396438 ("Unsigned compared against 0")
>>
>> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>> ---
>>  drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 6 ------
> 
> This file doesn't exist in mainline.
> 
>>  1 file changed, 6 deletions(-)
>>
>> diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
>> index 3b86d3d..a345166 100644
>> --- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
>> +++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
>> @@ -665,12 +665,6 @@ static void ti_iodelay_pin_dbg_show(struct pinctrl_dev *pctldev,
>>         r = iod->reg_data;
>>
>>         offset = ti_iodelay_pin_to_offset(iod, pin);
>> -       if (pin < 0) {
> 
> Shouldn't this be "if (offset < 0)"?

Yep. However if the code was correct and using offset:

	if (offset < 0) {
		...
	
then we still get the same issue, that is, offset is unsigned so that
comparison is redundant since it can't be < 0.  Perhaps I should re-send
a V3 with an updated commit message.


> 
> 
>> -               dev_err(iod->dev, "invalid pin offset for pin%i\n", pin);
>> -
>> -               return;
>> -       }
>> -
>>         pd = &iod->pa[pin];
>>         cfg = pd->drv_data;
>>
>> --
>> 2.10.2
>>

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux