pinctrl: remove redundant pin < 0 check on unsigned int
diff mbox

Message ID 20170113132039.19830-1-colin.king@canonical.com
State New
Headers show

Commit Message

Colin Ian King Jan. 13, 2017, 1:20 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

pin is an unsigned int and therefore can never be < 0 so
this check is redudant. 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(-)

Comments

Nishanth Menon Jan. 13, 2017, 8:41 p.m. UTC | #1
On 01/13/2017 07:20 AM, 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 redudant. Remove the check and the associated
s/redudant/redundant/

> 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;
>
>

Thanks.

just the $subject could probably be "pinctrl: ti-iodelay:..."

Other than these:

Acked-by: Nishanth Menon <nm@ti.com>
Linus Walleij Jan. 18, 2017, 9:24 a.m. UTC | #2
On Fri, Jan 13, 2017 at 2:20 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 redudant. 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>

Fixed up speling & commit topic and applied with
Nishanth's ACK!

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

Patch
diff mbox

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;