From: Geert Uytterhoeven <geert@linux-m68k.org>
To: "GONG, Ruiqi" <gongruiqi@huaweicloud.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, gongruiqi1@huawei.com,
linux-sparse@vger.kernel.org
Subject: Re: [PATCH] clk: renesas: r8a7778: remove checker warnings: x | !y
Date: Tue, 13 Jun 2023 09:39:36 +0200 [thread overview]
Message-ID: <CAMuHMdUhp7AntSk1ZnTowiEC6XibR1im_7OKdF2JDg=51ewsyw@mail.gmail.com> (raw)
In-Reply-To: <20230613025403.3338129-1-gongruiqi@huaweicloud.com>
Hi Gong,
On Tue, Jun 13, 2023 at 4:50 AM GONG, Ruiqi <gongruiqi@huaweicloud.com> wrote:
> Eliminate the following Sparse reports when building with C=1:
>
> drivers/clk/renesas/clk-r8a7778.c:85:52: warning: dubious: x | !y
> drivers/clk/renesas/clk-r8a7778.c:87:50: warning: dubious: x | !y
>
> Signed-off-by: GONG, Ruiqi <gongruiqi@huaweicloud.com>
Thanks for your patch!
Looks like sparse needs to be taught the "|" is not used in a boolean
context here?
See also
https://lore.kernel.org/r/CAMuHMdXGG2xu+nXJt6CSTfV6aM=U=hMW+DiDgP3RhOw8+O8y=A@mail.gmail.com
> --- a/drivers/clk/renesas/clk-r8a7778.c
> +++ b/drivers/clk/renesas/clk-r8a7778.c
> @@ -81,11 +81,11 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np)
>
> BUG_ON(!(mode & BIT(19)));
>
> - cpg_mode_rates = (!!(mode & BIT(18)) << 2) |
> - (!!(mode & BIT(12)) << 1) |
> - (!!(mode & BIT(11)));
> - cpg_mode_divs = (!!(mode & BIT(2)) << 1) |
> - (!!(mode & BIT(1)));
> + cpg_mode_rates = (mode & BIT(18) ? BIT(2) : 0) |
> + (mode & BIT(12) ? BIT(1) : 0) |
> + (mode & BIT(11) ? BIT(0) : 0);
> + cpg_mode_divs = (mode & BIT(2) ? BIT(1) : 0) |
> + (mode & BIT(1) ? BIT(0) : 0);
>
> num_clks = of_property_count_strings(np, "clock-output-names");
> if (num_clks < 0) {
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2023-06-13 7:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 2:54 [PATCH] clk: renesas: r8a7778: remove checker warnings: x | !y GONG, Ruiqi
2023-06-13 7:39 ` Geert Uytterhoeven [this message]
2023-06-14 10:17 ` David Laight
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='CAMuHMdUhp7AntSk1ZnTowiEC6XibR1im_7OKdF2JDg=51ewsyw@mail.gmail.com' \
--to=geert@linux-m68k.org \
--cc=gongruiqi1@huawei.com \
--cc=gongruiqi@huaweicloud.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.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).