Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Benoît Monin" <benoit.monin@bootlin.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v8 6/9] clk: eyeq: Introduce a generic clock type
Date: Thu, 04 Jun 2026 13:51:06 +0000	[thread overview]
Message-ID: <20260604135106.867711F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604-clk-eyeq7-v8-6-53f618174cf6@bootlin.com>

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

Pre-existing issues:
- [High] Missing spinlock in divider clock registration allows read-modify-write races on shared registers.
--

commit 64cecba2d1878b01e3dd2fecb67b0bb43fd51ec6
Author: Benoît Monin <benoit.monin@bootlin.com>

clk: eyeq: Introduce a generic clock type

This commit introduces a generic eqc_clock structure to represent PLLs,
dividers, and fixed factors for the Mobileye EyeQ OLB. It includes specific
probe and unregister functions for each clock type to support complex clock
interdependencies.

> diff --git a/drivers/clk/clk-eyeq.c b/drivers/clk/clk-eyeq.c
> index e4e690a12a238..7b8de08388d3b 100644
> --- a/drivers/clk/clk-eyeq.c
> +++ b/drivers/clk/clk-eyeq.c

[ ... ]

> @@ -336,6 +376,102 @@ static void eqc_auxdev_create_optional(struct device *dev, void __iomem *base,

[ ... ]

> +static int eqc_probe_divider(struct device *dev, struct device_node *np,
> +			     const struct eqc_clock *clk, void __iomem *base,
> +			     struct clk_hw_onecell_data *cells)
> +{
> +	struct clk_parent_data parent_data;
> +	struct clk_hw *hw;
> +	int ret;
> +
> +	ret = eqc_fill_parent_data(clk, cells, &parent_data);
> +	if (ret)
> +		return ret;
> +
> +	hw = clk_hw_register_divider_table_parent_data(dev, clk->name,
> +			&parent_data, 0, base + clk->div.reg, clk->div.shift,
> +			clk->div.width, clk->div.flags, clk->div.table, NULL);

[Severity: High]
This isn't a bug introduced by this patch, but since multiple writable
clock dividers share the same physical register (for example, div-ospi-ref
and div-ospi-sys share the register at 0x090), can concurrent clk_set_rate()
calls cause read-modify-write races here?

Because NULL is passed as the lock parameter, the clock divider core will
perform a lockless read-modify-write sequence. Would it be safer to provide
a shared spinlock to protect the register state?

> +	if (IS_ERR(hw))
> +		return PTR_ERR(hw);
> +
> +	cells->hws[clk->index] = hw;
> +	return 0;
> +}

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260604-clk-eyeq7-v8-0-53f618174cf6@bootlin.com?part=6

  reply	other threads:[~2026-06-04 13:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 13:26 [PATCH v8 0/9] Add clock and reset support for Mobileye EyeQ7H Benoît Monin
2026-06-04 13:26 ` [PATCH v8 1/9] dt-bindings: soc: mobileye: Add EyeQ7H OLB Benoît Monin
2026-06-04 13:26 ` [PATCH v8 2/9] reset: eyeq: Add EyeQ7H compatibles Benoît Monin
2026-06-04 13:26 ` [PATCH v8 3/9] clk: fixed-factor: Rework initialization with parent clocks Benoît Monin
2026-06-04 13:26 ` [PATCH v8 4/9] clk: fixed-factor: Export __clk_hw_register_fixed_factor() Benoît Monin
2026-06-04 13:26 ` [PATCH v8 5/9] clk: eyeq: Prefix the PLL registers with the PLL type Benoît Monin
2026-06-04 13:36   ` sashiko-bot
2026-06-04 13:26 ` [PATCH v8 6/9] clk: eyeq: Introduce a generic clock type Benoît Monin
2026-06-04 13:51   ` sashiko-bot [this message]
2026-06-04 13:26 ` [PATCH v8 7/9] clk: eyeq: Convert clocks declaration to eqc_clock Benoît Monin
2026-06-04 13:44   ` sashiko-bot
2026-06-04 13:26 ` [PATCH v8 8/9] clk: eyeq: Drop PLL, dividers, and fixed factors structs Benoît Monin
2026-06-04 13:26 ` [PATCH v8 9/9] clk: eyeq: Add EyeQ7H compatibles Benoît Monin
2026-06-04 13:43   ` sashiko-bot

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=20260604135106.867711F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=benoit.monin@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.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