From: aisheng.dong@nxp.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] pinctrl: imx: fix unsigned check if nfuncs with less than or equal zero
Date: Sat, 28 Apr 2018 03:01:48 +0800 [thread overview]
Message-ID: <1524855713-15527-2-git-send-email-aisheng.dong@nxp.com> (raw)
In-Reply-To: <1524855713-15527-1-git-send-email-aisheng.dong@nxp.com>
The unsigned integer nfuncs is being error checked with a value less
or equal to zero; this is always false if of_get_child_count returns a
-ve for an error condition since nfuncs is not signed. Fix this by
making variables nfuncs and i signed integers.
Detected with Coccinelle:
drivers/pinctrl/freescale/pinctrl-imx.c:620:6-12: WARNING: Unsigned
expression compared with zero: nfuncs <= 0
Cc: Linus Walleij <linus.walleij@linaro.org>
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 24aaddd..77cd364 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -617,7 +617,7 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev,
nfuncs = 1;
} else {
nfuncs = of_get_child_count(np);
- if (nfuncs <= 0) {
+ if (nfuncs == 0) {
dev_err(&pdev->dev, "no functions defined\n");
return -EINVAL;
}
--
2.7.4
next prev parent reply other threads:[~2018-04-27 19:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 19:01 [PATCH 0/6] pinctrl: imx: add imx8qxp pinctrl support Dong Aisheng
2018-04-27 19:01 ` Dong Aisheng [this message]
2018-05-02 12:22 ` [PATCH 1/6] pinctrl: imx: fix unsigned check if nfuncs with less than or equal zero Linus Walleij
2018-04-27 19:01 ` [PATCH 2/6] pinctrl: pinctrl-imx: improve the code comments of PIN_FUNC_ID Dong Aisheng
2018-05-02 12:23 ` Linus Walleij
2018-04-27 19:01 ` [PATCH 3/6] pinctrl: imx: use seq_puts() instead of seq_printf() Dong Aisheng
2018-05-02 12:24 ` Linus Walleij
2018-04-27 19:01 ` [PATCH 4/6] pinctrl: fsl: add scu based pinctrl support Dong Aisheng
2018-05-02 12:27 ` Linus Walleij
2018-05-02 12:29 ` Linus Walleij
2018-05-02 12:36 ` Sascha Hauer
2018-05-02 13:03 ` Linus Walleij
2018-05-02 15:05 ` Sascha Hauer
2018-05-02 18:42 ` A.s. Dong
2018-04-27 19:01 ` [PATCH 5/6] dt-bindings: pinctrl: add imx8qxp pinctrl binding doc Dong Aisheng
2018-05-01 15:58 ` Rob Herring
2018-05-02 18:07 ` A.s. Dong
2018-04-27 19:01 ` [PATCH 6/6] pinctrl: imx: add imx8qxp driver Dong Aisheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524855713-15527-2-git-send-email-aisheng.dong@nxp.com \
--to=aisheng.dong@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).