Re: [PATCH] pinctrl: qcom: spmi-gpio: Assign boolean values to a bool variable

From: Linus Walleij
Date: Fri Jan 22 2021 - 08:18:01 EST


On Thu, Jan 21, 2021 at 4:19 AM Bjorn Andersson
<bjorn.andersson@xxxxxxxxxx> wrote:
> On Wed 20 Jan 01:29 CST 2021, Jiapeng Zhong wrote:
>
> > Fix the following coccicheck warnings:
> >
> > ./drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c:340:3-15: WARNING:
> > Assignment of 0/1 to bool variable.
> >
> > Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
> > Signed-off-by: Jiapeng Zhong <abaci-bugfix@xxxxxxxxxxxxxxxxx>
>
> Reviewed-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
>
> Although we're mixing bool/int on line 417 and 637 as well, with:
>
> val |= pin->disable;
>
> and
>
> pin->disable = val & BIT(0);
>
> respectively. The latter could be dealt with using !!(val & BIT(0)); I
> guess the appropriate for for the prior is:
>
> if (pin->disable)
> val |= BIT(0);
>
> If you would like to update your patch with these as well I'd be happy
> to review this.

I would opt for a respin with the above when we are anyways at it,
no hurry as it is no regression anyway.

Yours,
Linus Walleij