Re: [PATCH] pinctrl: ret needs to be an int for -ve return value from regmap_update_bits

From: Andrew Jeffery
Date: Sun Sep 11 2016 - 22:01:07 EST


On Sun, 2016-09-11 at 09:36 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>

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: signature.asc
Description: This is a digitally signed message part