Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1558747 > unrolled thread

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

Started byColin King <colin.king@canonical.com>
First post2017-01-13 22:10 +0100
Last post2017-01-16 17:00 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check on unsigned int Colin King <colin.king@canonical.com> - 2017-01-13 22:10 +0100
    Re: [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check  on unsigned int Nishanth Menon <nm@ti.com> - 2017-01-14 17:50 +0100
    Re: [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check  on unsigned int Rob Herring <robh@kernel.org> - 2017-01-16 16:50 +0100
      Re: [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check  on unsigned int Colin Ian King <colin.king@canonical.com> - 2017-01-16 17:00 +0100

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

FromColin King <colin.king@canonical.com>
Date2017-01-13 22:10 +0100
Subject[PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check on unsigned int
Message-ID<sZhgK-5N3-7@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

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.

Fixes CoverityScan CID#1396438 ("Unsigned compared against 0")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 6 ------
 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) {
-		dev_err(iod->dev, "invalid pin offset for pin%i\n", pin);
-
-		return;
-	}
-
 	pd = &iod->pa[pin];
 	cfg = pd->drv_data;
 
-- 
2.10.2

[toc] | [next] | [standalone]


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

FromNishanth Menon <nm@ti.com>
Date2017-01-14 17:50 +0100
SubjectRe: [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check on unsigned int
Message-ID<sZzGG-8eP-11@gated-at.bofh.it>
In reply to#1558747
On 01/13/2017 03:06 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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.
>
> Fixes CoverityScan CID#1396438 ("Unsigned compared against 0")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 6 ------
>  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) {
> -		dev_err(iod->dev, "invalid pin offset for pin%i\n", pin);
> -
> -		return;
> -	}
> -
>  	pd = &iod->pa[pin];
>  	cfg = pd->drv_data;
>
>

Acked-by: Nishanth Menon <nm@ti.com>

-- 
Regards,
Nishanth Menon

[toc] | [prev] | [next] | [standalone]


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

FromRob Herring <robh@kernel.org>
Date2017-01-16 16:50 +0100
SubjectRe: [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check on unsigned int
Message-ID<t0hHH-2nd-3@gated-at.bofh.it>
In reply to#1558747
On Fri, Jan 13, 2017 at 3:06 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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@canonical.com>
> ---
>  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)"?


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

[toc] | [prev] | [next] | [standalone]


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

FromColin Ian King <colin.king@canonical.com>
Date2017-01-16 17:00 +0100
SubjectRe: [PATCH][V2] pinctrl: ti-iodelay: remove redundant pin < 0 check on unsigned int
Message-ID<t0hRn-2rw-3@gated-at.bofh.it>
In reply to#1559843
On 16/01/17 15:45, Rob Herring wrote:
> On Fri, Jan 13, 2017 at 3:06 PM, Colin King <colin.king@canonical.com> wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> 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@canonical.com>
>> ---
>>  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
>>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web