From: sashiko-bot@kernel.org
To: "Geert Uytterhoeven" <geert+renesas@glider.be>
Cc: dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev,
linux-clk@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/sun4i: Make sure clk_init_data is fully initialized
Date: Fri, 21 Aug 2026 10:13:25 +0000 [thread overview]
Message-ID: <20260821101326.5103C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <0f37278d04c02461e17f42032a379dccfb773171.1787239944.git.geert+renesas@glider.be>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Resource leak and duplicate registration failure due to misuse of `devm_` APIs against an external device in a component `.bind` callback.
--
--- Patch [1]: [PATCH 1/2] drm/sun4i: Make sure clk_init_data is fully initialized ---
commit c10328b2f0b88fab02ca03cdd9ba8cea5c03c556
Author: Geert Uytterhoeven <geert+renesas@glider.be>
drm/sun4i: Make sure clk_init_data is fully initialized
This commit zero-initializes the clk_init_data structure to ensure all
members are fully initialized. This prevents subtle issues when only
some mutually-exclusive members are set, especially under certain stack
initialization configs.
[ ... ]
> diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
> index a4d31fe3abff1..bd0dba95421b3 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
> @@ -143,7 +143,7 @@ static const struct clk_ops sun8i_phy_clk_ops = {
> int sun8i_phy_clk_create(struct sun8i_hdmi_phy *phy, struct device *dev,
> bool second_parent)
> {
> - struct clk_init_data init;
> + struct clk_init_data init = {};
> struct sun8i_phy_clk *priv;
> const char *parents[2];
>
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential problem
with resource lifetimes in this function.
During the component bind phase, this code uses devm_kzalloc() and
devm_clk_register() against the external PHY platform device:
sun8i_phy_clk_create() {
...
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
...
phy->clk_phy = devm_clk_register(dev, &priv->hw);
...
}
Because the devres group is attached to the external PHY device (`dev`) rather
than the component device, it escapes the component unbind cycle.
When the HDMI component is unbound and re-bound, sun8i_phy_clk_create() runs
again. Will this permanently leak the memory allocated for `priv`?
Furthermore, will devm_clk_register() fail with -EEXIST on the second bind
since the previous clock was never unregistered?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787239944.git.geert+renesas@glider.be?part=1
next prev parent reply other threads:[~2026-08-21 10:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 10:03 [PATCH 0/2] drm: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-21 10:03 ` [PATCH 1/2] drm/sun4i: " Geert Uytterhoeven
2026-08-21 10:13 ` sashiko-bot [this message]
2026-08-21 13:41 ` Chen-Yu Tsai
2026-08-21 10:03 ` [PATCH 2/2] drm/tegra: " Geert Uytterhoeven
2026-08-21 10:13 ` 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=20260821101326.5103C1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=linux-clk@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.