From: sashiko-bot@kernel.org
To: "Sean Young" <sean@mess.org>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH 5/7] media: meson-ir-tx: Ensure clock is disabled on unbind
Date: Fri, 10 Jul 2026 09:05:58 +0000 [thread overview]
Message-ID: <20260710090558.BACCD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <2d7772d678d1815276c2d409d68ae4f4673d09aa.1783673420.git.sean@mess.org>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Low] The commit message refers to non-existent clock API functions.
Pre-existing issues:
- [High] The driver masks `-EPROBE_DEFER` and other error codes by unconditionally returning `-ENODEV` when `devm_clk_get_enabled()` or `platform_get_irq()` fails, breaking probe deferral.
- [High] The `rc_dev` structure allocated during probe is permanently leaked on driver unbind due to the use of `rc_allocate_device()` without ensuring a corresponding `rc_free_device()` call.
--
--- Patch [5]: [PATCH 5/7] media: meson-ir-tx: Ensure clock is disabled on unbind ---
commit e95895078113495fea5b981fafe002c5ff1f56c1
Author: Sean Young <sean@mess.org>
media: meson-ir-tx: Ensure clock is disabled on unbind
This patch changes the clock acquisition in the meson-ir-tx driver to use
the devres managed devm_clk_get_enabled(). This ensures the clock is
automatically disabled and unprepared when the driver unbinds.
> clk_prepare_enabled() needs a call to clk_disable_prepare() on
> driver unbind. Make it devm managed.
[Severity: Low]
This isn't a bug, but there are typos in the function names mentioned here.
Should they be clk_prepare_enable() and clk_disable_unprepare() instead?
> diff --git a/drivers/media/rc/meson-ir-tx.c b/drivers/media/rc/meson-ir-tx.c
> index fded2c256f2a6..e7bb107e6a843 100644
> --- a/drivers/media/rc/meson-ir-tx.c
> +++ b/drivers/media/rc/meson-ir-tx.c
> @@ -288,8 +288,8 @@ static int meson_irtx_mod_clock_probe(struct meson_irtx *ir,
> if (!np)
> return -ENODEV;
>
> - clock = devm_clk_get(ir->dev, "xtal");
> - if (IS_ERR(clock) || clk_prepare_enable(clock))
> + clock = devm_clk_get_enabled(ir->dev, "xtal");
> + if (IS_ERR(clock))
> return -ENODEV;
[Severity: High]
This is a pre-existing issue, but does this incorrectly mask -EPROBE_DEFER?
If devm_clk_get_enabled() returns -EPROBE_DEFER, returning a hardcoded
-ENODEV will permanently fail the probe instead of allowing it to defer.
Would it be better to return PTR_ERR(clock) here?
The same issue appears to happen with platform_get_irq() in
meson_irtx_probe():
drivers/media/rc/meson-ir-tx.c:meson_irtx_probe() {
...
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return -ENODEV;
...
}
Would it be better to propagate these error codes directly?
[Severity: High]
This is another pre-existing issue, but does this driver permanently leak
the rc_dev structure on unbind?
The driver allocates the structure manually in meson_irtx_probe():
drivers/media/rc/meson-ir-tx.c:meson_irtx_probe() {
...
rc = rc_allocate_device(RC_DRIVER_IR_RAW_TX);
...
ret = devm_rc_register_device(dev, rc);
...
}
Since devm_rc_register_device() only ties rc_unregister_device() to the
devres cleanup, and there is no matching rc_free_device() call or use of
devm_rc_allocate_device(), does the initial reference count remain
un-dropped when the driver is unbound?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783673420.git.sean@mess.org?part=5
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-07-10 9:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 8:53 [PATCH 0/7] Fix leaks in rc core Sean Young
2026-07-10 8:53 ` [PATCH 1/7] media: streamzap: Add missing rc_unregister_device() Sean Young
2026-07-10 8:53 ` [PATCH 2/7] media: redrat3: Ensure rc device is freed if enable_detector() fails Sean Young
2026-07-10 8:53 ` [PATCH 3/7] media: redrat3: Ensure we don't read beyond the end of the packet Sean Young
2026-07-10 8:53 ` [PATCH 4/7] media: sunxi-cir: Ensure no more interrupts can occur before free Sean Young
2026-07-10 9:03 ` sashiko-bot
2026-07-10 8:53 ` [PATCH 5/7] media: meson-ir-tx: Ensure clock is disabled on unbind Sean Young
2026-07-10 8:53 ` Sean Young
2026-07-10 9:05 ` sashiko-bot [this message]
2026-07-12 13:26 ` Martin Blumenstingl
2026-07-12 13:26 ` Martin Blumenstingl
2026-07-10 8:53 ` [PATCH 6/7] media: meson-ir-tx: Ensure rc_free_device() is called " Sean Young
2026-07-10 8:53 ` Sean Young
2026-07-12 13:23 ` Martin Blumenstingl
2026-07-12 13:23 ` Martin Blumenstingl
2026-07-10 8:53 ` [PATCH 7/7] media: ir-hix5hd2: Ensure rdev is setup before interrupts are enabled Sean Young
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=20260710090558.BACCD1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sean@mess.org \
/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.