Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v8 3/3] clk: en7523: add support for Airoha AN7583 clock
Date: Sun, 11 Oct 2026 19:02:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-167394@kernel.org> (raw)
In-Reply-To: <20261011185238.52229-4-ansuelsmth@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] clk: en7523: build failure due to undeclared 'priv' in an7583_clk_hw_init
- [High] clk: en7523: missing spinlock in reset controller update
- [Low] clk: en7523: undeclared 'priv' variable breaks build in an7583_clk_hw_init
--

commit bdbd93bdb15e9361a92abee5427344b8ccd03042
Author: Christian Marangi <ansuelsmth@gmail.com>

clk: en7523: add support for Airoha AN7583 clock

Add support for Airoha AN7583 clock and reset. Airoha AN7583 SoC have
the same register address of EN7581 but implement different bits and
additional base clocks.

> diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
> index ec66a504d4c55..e8c61474c1f98 100644
> --- a/drivers/clk/clk-en7523.c
> +++ b/drivers/clk/clk-en7523.c
[ ... ]
> @@ -1088,6 +1287,42 @@ static int en7581_clk_hw_init(struct platform_device *pdev,
>  	return en7581_serdes_phy_register(&pdev->dev);
>  }
>  
> +static int an7583_clk_hw_init(struct platform_device *pdev,
> +			      struct clk_hw_onecell_data *clk_data)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct regmap *map;
> +	void __iomem *base;
> +	u32 val;
> +	int ret;
> +
> +	map = syscon_regmap_lookup_by_phandle(dev->of_node, "airoha,chip-scu");
> +	if (IS_ERR(map))
> +		return PTR_ERR(map);
> +
> +	base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(base))
> +		return PTR_ERR(base);
> +
> +	priv->base = base;

[Severity: High]
Does this code break the build by using an undeclared identifier?

It appears the pointer priv is never declared, initialized, or fetched
(e.g., via platform_get_drvdata(pdev)) in an7583_clk_hw_init().

[Severity: Low]
Does this function also unintentionally omit the PCIe SCU register
initialization (REG_NP_SCU_SSTR and REG_NP_SCU_PCIC)?

These were initialized in en7581_clk_hw_init(), and it looks like their
omission here stems from the same adaptation that left the priv pointer
undeclared.

[ ... ]
> +
> +	val = readl(base + REG_RST_CTRL1);
> +	val |= REG_PCIE_HB_RST;
> +	writel(val, base + REG_RST_CTRL1);
> +	val &= ~REG_PCIE_HB_RST;
> +	writel(val, base + REG_RST_CTRL1);
> +
> +	ret = en7581_reset_register(dev, base, an7583_rst_map,
> +				    ARRAY_SIZE(an7583_rst_map),
> +				    en7581_rst_ofs);

[Severity: High]
Can this mapping cause lost reset updates due to concurrent driver access?

By registering these reset lines, different drivers will manage their IP block
resets independently. However, the shared reset bank registers appear to be
modified without any locks:

static int en7523_reset_update(...)
{
	...
	val = readl(addr);
	if (assert ^ inverted)
		val |= BIT(id % RST_NR_PER_BANK);
	else
		val &= ~BIT(id % RST_NR_PER_BANK);
	writel(val, addr);
	...
}

If two different drivers assert or deassert resets concurrently mapped to the
same bank, could this unprotected read-modify-write sequence lead to a race
condition where a hardware IP is left incorrectly in reset or unexpectedly
pulled out of reset?

> +	if (ret)
> +		return ret;
> +
> +	return en7581_serdes_phy_register(dev);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011185238.52229-1-ansuelsmth@gmail.com?part=3

      reply	other threads:[~2026-10-11 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 18:52 [PATCH v8 0/3] clk: add support for Airoha AN7583 clock Christian Marangi
2026-10-11 18:52 ` [PATCH v8 1/3] dt-bindings: clock: airoha: Document support for " Christian Marangi
2026-10-11 18:58   ` sashiko-bot
2026-10-11 18:52 ` [PATCH v8 2/3] clk: en7523: generalize register clocks function Christian Marangi
2026-10-11 18:52 ` [PATCH v8 3/3] clk: en7523: add support for Airoha AN7583 clock Christian Marangi
2026-10-11 19:02   ` sashiko-bot [this message]

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=sashiko-outbox-167394@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ansuelsmth@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@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