Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geert Uytterhoeven" <geert+renesas@glider.be>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v2 3/6] clk: renesas: Add R-Car X5H CPG driver
Date: Wed, 08 Jul 2026 10:24:29 +0000	[thread overview]
Message-ID: <20260708102429.D76361F000E9@smtp.kernel.org> (raw)
In-Reply-To: <50f5804f00c55cd60604d00da1bf1f1dc912ba8d.1783505142.git.geert+renesas@glider.be>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Memory and clock registration leak if `devm_kasprintf()` fails during fixed clock registration.
--

--- Patch [3]: [PATCH v2 3/6] clk: renesas: Add R-Car X5H CPG driver ---
commit 1d0eaa24ed7151f3cc9ee126c74cd79bec68356e
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Wed Jul 8 10:15:08 2026 +0000

clk: renesas: Add R-Car X5H CPG driver

This patch adds a minimal Clock Pulse Generator driver for the R-Car X5H
(R8A78000) SoC. It provides support for the fixed-rate clocks needed by the
current minimal DTS.

> diff --git a/drivers/clk/renesas/r8a78000-cpg.c b/drivers/clk/renesas/r8a78000-cpg.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/clk/renesas/r8a78000-cpg.c

[ ... ]

> +static int register_fixed_clks(struct r8a78000_cpg_priv *priv)
> +{
> +	struct device *dev = priv->dev;
> +	unsigned long rate;
> +	struct clk_hw *hw;
> +	const char *name;
> +
> +	for (unsigned int i = 0; i < ARRAY_SIZE(fixed_clk_rates); i++) {
> +		rate = fixed_clk_rates[i];
> +		name = devm_kasprintf(dev, GFP_KERNEL, "cpg-%lu", rate);
> +		if (!name)
> +			return -ENOMEM;

[Severity: Medium]
If devm_kasprintf() fails on a later iteration, does this return statement
leak the clocks that were successfully registered in previous iterations?

The cleanup loop for clk_hw_unregister_fixed_rate() is only executed if
clk_hw_register_fixed_rate() fails, and the devres action to unregister
the clocks is not added until the end of the function.

> +
> +		hw = clk_hw_register_fixed_rate(dev, name, NULL, 0, rate);
> +		if (IS_ERR(hw)) {
> +			while (i-- > 0)
> +				clk_hw_unregister_fixed_rate(priv->fixed_hws[i]);
> +			return PTR_ERR(hw);
> +		}
> +
> +		priv->fixed_hws[i] = hw;
> +	}
> +
> +	return devm_add_action_or_reset(dev, unregister_fixed_clks, priv);
> +}

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

  reply	other threads:[~2026-07-08 10:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 10:15 [PATCH v2 0/6] R-Car X5H CPG/MDLC support Geert Uytterhoeven
2026-07-08 10:15 ` [PATCH v2 1/6] dt-bindings: clock: Document Renesas R-Car X5H Clock Pulse Generator Geert Uytterhoeven
2026-07-08 16:32   ` Conor Dooley
2026-07-08 10:15 ` [PATCH v2 2/6] dt-bindings: power: Document Renesas R-Car X5H Module Controller Geert Uytterhoeven
2026-07-08 12:38   ` Marek Vasut
2026-07-08 16:32   ` Conor Dooley
2026-07-08 10:15 ` [PATCH v2 3/6] clk: renesas: Add R-Car X5H CPG driver Geert Uytterhoeven
2026-07-08 10:24   ` sashiko-bot [this message]
2026-07-08 12:40   ` Marek Vasut
2026-07-09  9:49     ` Geert Uytterhoeven
2026-07-08 10:15 ` [PATCH v2 4/6] pmdomain: renesas: Add R-Car X5H MDLC driver Geert Uytterhoeven
2026-07-08 10:36   ` sashiko-bot
2026-07-08 12:47   ` Marek Vasut
2026-07-09 10:29     ` Geert Uytterhoeven
2026-07-08 10:15 ` [PATCH v2 5/6] arm64: dts: renesas: r8a78000: Add CPG node Geert Uytterhoeven
2026-07-08 12:51   ` Marek Vasut
2026-07-08 10:15 ` [PATCH v2 6/6] arm64: dts: renesas: r8a78000: Add MDLC nodes Geert Uytterhoeven
2026-07-08 10:47   ` sashiko-bot
2026-07-09 10:15     ` Geert Uytterhoeven
2026-07-08 13:07   ` Marek Vasut
2026-07-09 10:24     ` Geert Uytterhoeven
2026-07-09 11:24       ` Marek Vasut

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=20260708102429.D76361F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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