* [PATCH] pinctrl: ret needs to be an int for -ve return value from regmap_update_bits
@ 2016-09-11 8:36 Colin King
2016-09-12 2:00 ` Andrew Jeffery
2016-09-13 8:44 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2016-09-11 8:36 UTC (permalink / raw)
To: Linus Walleij, Andrew Jeffery, Joel Stanley, linux-gpio; +Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Macro regmap_update_bits can return a -ve on an error value so ret
needs to be an integer rather than a bool type.
Fixes warning found by static analysis with cppcheck:
[drivers/pinctrl/aspeed/pinctrl-aspeed.c:192]: (warning) Comparison of
a boolean expression with an integer other than 0 or 1.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/pinctrl/aspeed/pinctrl-aspeed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
index 7d461fc..75935ab 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
@@ -166,7 +166,7 @@ static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
bool enable, struct regmap *map)
{
int i;
- bool ret;
+ int ret;
ret = aspeed_sig_expr_eval(expr, enable, map);
if (ret)
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: ret needs to be an int for -ve return value from regmap_update_bits
2016-09-11 8:36 [PATCH] pinctrl: ret needs to be an int for -ve return value from regmap_update_bits Colin King
@ 2016-09-12 2:00 ` Andrew Jeffery
2016-09-13 8:44 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Jeffery @ 2016-09-12 2:00 UTC (permalink / raw)
To: Colin King, Linus Walleij, Joel Stanley, linux-gpio
Cc: linux-kernel, Arnd Bergmann
[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]
On Sun, 2016-09-11 at 09:36 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Macro regmap_update_bits can return a -ve on an error value so ret
> needs to be an integer rather than a bool type.
>
> Fixes warning found by static analysis with cppcheck:
> [drivers/pinctrl/aspeed/pinctrl-aspeed.c:192]: (warning) Comparison of
> a boolean expression with an integer other than 0 or 1.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Thanks Colin. Arnd independently discovered this bug and Joel and I
have CC'ed you on our responses there - the intent is to take Arnd's
patch.
Cheers,
Andrew
> ---
> drivers/pinctrl/aspeed/pinctrl-aspeed.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> index 7d461fc..75935ab 100644
> --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
> @@ -166,7 +166,7 @@ static bool aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
> bool enable, struct regmap *map)
> {
> int i;
> - bool ret;
> + int ret;
>
> ret = aspeed_sig_expr_eval(expr, enable, map);
> if (ret)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: ret needs to be an int for -ve return value from regmap_update_bits
2016-09-11 8:36 [PATCH] pinctrl: ret needs to be an int for -ve return value from regmap_update_bits Colin King
2016-09-12 2:00 ` Andrew Jeffery
@ 2016-09-13 8:44 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2016-09-13 8:44 UTC (permalink / raw)
To: Colin King
Cc: Andrew Jeffery, Joel Stanley, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Sun, Sep 11, 2016 at 10:36 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Macro regmap_update_bits can return a -ve on an error value so ret
> needs to be an integer rather than a bool type.
>
> Fixes warning found by static analysis with cppcheck:
> [drivers/pinctrl/aspeed/pinctrl-aspeed.c:192]: (warning) Comparison of
> a boolean expression with an integer other than 0 or 1.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Dropping this but added your Reported-by to Arnds patch.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-13 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-11 8:36 [PATCH] pinctrl: ret needs to be an int for -ve return value from regmap_update_bits Colin King
2016-09-12 2:00 ` Andrew Jeffery
2016-09-13 8:44 ` Linus Walleij
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).