Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geert Uytterhoeven" <geert+renesas@glider.be>
Cc: linux-clk@vger.kernel.org, neil.armstrong@linaro.org,
	linux-amlogic@lists.infradead.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH treewide 2/5] clk: visconti: Make sure clk_init_data is fully initialized
Date: Wed, 19 Aug 2026 19:14:48 +0000	[thread overview]
Message-ID: <20260819191449.3C8A91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <42dd7be99acbbea1343e2fcc0ba4ffb91f8517ca.1787165329.git.geert+renesas@glider.be>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] visconti_reset_status() incorrectly uses the bit index directly instead of a bitmask, resulting in corrupted status checks.
--

--- Patch [2]: [PATCH treewide 2/5] clk: visconti: Make sure clk_init_data is fully initialized ---
commit 61772ea3c610a3b3ebf435b199e400c1c5aaee4c
Author: Geert Uytterhoeven <geert+renesas@glider.be>

clk: visconti: Make sure clk_init_data is fully initialized

The clk_init_data structure contains several mutually-exclusive members for
different methods to specify the possible parents of a clock. Not
initializing all members may cause subtle issues when uninitialized members
are unexpectedly accessed. This commit ensures all members are fully
initialized to zero.

> diff --git a/drivers/clk/visconti/clkc.c b/drivers/clk/visconti/clkc.c
> index d0b193b5d0b35..4018d1298880d 100644
> --- a/drivers/clk/visconti/clkc.c
> +++ b/drivers/clk/visconti/clkc.c
> @@ -81,9 +81,9 @@ static struct clk_hw *visconti_clk_register_gate(struct device *dev,
>  						 u8	rs_idx,
>  						 spinlock_t *lock)
>  {
> +	struct clk_init_data init = {};
>  	struct visconti_clk_gate *gate;
>  	struct clk_parent_data *pdata;
> -	struct clk_init_data init;
>  	struct clk_hw *hw;
>  	int ret;
>  

[Severity: High]
This is a pre-existing issue, but while reviewing the visconti clock and
reset driver changes, I noticed a potential problem with how rs_idx is used.

In drivers/clk/visconti/reset.c:visconti_reset_status():

	spin_lock_irqsave(reset->lock, flags);
	ret = regmap_read(reset->regmap, data->rson_offset, &reg);
	spin_unlock_irqrestore(reset->lock, flags);
	if (ret)
		return ret;

	return !(reg & data->rs_idx);

Is this reset status check operating as intended? Since rs_idx is a raw bit
index (0-31), would it be more accurate to mask the register with
BIT(data->rs_idx) rather than the raw index value?

Masking with the raw index seems like it could produce incorrect status
returns. For example, if rs_idx is 0, the mask would always evaluate to 0.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787165329.git.geert+renesas@glider.be?part=2

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-08-19 19:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 19:05 [PATCH treewide 0/5] clk: Make sure clk_init_data is fully initialized (part 1) Geert Uytterhoeven
2026-08-19 19:05 ` [PATCH treewide 1/5] clk: ti: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-19 19:10   ` sashiko-bot
2026-08-19 21:21   ` Brian Masney
2026-08-19 19:05 ` [PATCH treewide 2/5] clk: visconti: " Geert Uytterhoeven
2026-08-19 19:14   ` sashiko-bot [this message]
2026-08-19 21:21   ` Brian Masney
2026-08-20  2:03   ` nobuhiro.iwamatsu.x90
2026-08-19 19:05 ` [PATCH treewide 3/5] hwmon: (ltc4282) " Geert Uytterhoeven
2026-08-19 19:12   ` sashiko-bot
2026-08-19 20:32   ` Guenter Roeck
2026-08-19 21:22   ` Brian Masney
2026-08-19 19:05 ` [PATCH treewide 4/5] iio: frequency: adf4377: " Geert Uytterhoeven
2026-08-19 19:13   ` sashiko-bot
2026-08-19 21:22   ` Brian Masney
2026-08-20  1:38     ` Jonathan Cameron
2026-08-19 19:05 ` [PATCH treewide 5/5] spi: amlogic-spisg: " Geert Uytterhoeven
2026-08-19 19:13   ` sashiko-bot
2026-08-19 21:23   ` Brian Masney

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=20260819191449.3C8A91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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