Skip to content

Commit

Permalink
pinctrl: actions: fix unsigned less than zero comparison
Browse files Browse the repository at this point in the history
The check to see if platform_get_irq failed is performed on the
unsigned value of pctrl->irq[i] and the check is never true because
an unsigned cannot be less than zero.  Fix this by assinging the
signed int ret to the return of platform_get_irq and checking ret
instead.

Detected by CoverityScan, CID#1470247 ("Unsigned comparison against 0")

Fixes: 6c5d073 ("pinctrl: actions: Add interrupt support for OWL S900 SoC")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Colin Ian King authored and Linus Walleij committed Jul 2, 2018
1 parent 875a92b commit 23ee0f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/pinctrl/actions/pinctrl-owl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,11 +1026,10 @@ int owl_pinctrl_probe(struct platform_device *pdev,
}

for (i = 0; i < pctrl->num_irq ; i++) {
pctrl->irq[i] = platform_get_irq(pdev, i);
if (pctrl->irq[i] < 0) {
ret = pctrl->irq[i];
ret = platform_get_irq(pdev, i);
if (ret < 0)
goto err_exit;
}
pctrl->irq[i] = ret;
}

ret = owl_gpio_init(pctrl);
Expand Down

0 comments on commit 23ee0f1

Please sign in to comment.