Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 5/5] ASoC: rockchip: rockchip_pdm: Handle runtime PM resume failures in set_fmt
Date: Tue, 02 Jun 2026 13:09:51 +0000	[thread overview]
Message-ID: <20260602130952.22F591F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602101608.45137-6-phucduc.bui@gmail.com>

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

Pre-existing issues:
- [High] Unbalanced clock disable in `rockchip_pdm_remove` for `pdm->clk` causes an enable count underflow, leading to a kernel warning.
--

commit ecd4c53ebd06077db2d8eab0ef6ff0fdc098c863
Author: bui duc phuc <phucduc.bui@gmail.com>

ASoC: rockchip: rockchip_pdm: Handle runtime PM resume failures in set_fmt

This patch replaces pm_runtime_get_sync() with pm_runtime_resume_and_get()
in rockchip_pdm_set_fmt() and adds an early return on failure. This ensures
register accesses are not performed when the device state is undefined.

Reported-by: Sashiko AI Review <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/20260522110302.349421F000E9@smtp.kernel.org/
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

> diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c
> index 8f78f7bc1806c..115e90d3bbfe0 100644
> --- a/sound/soc/rockchip/rockchip_pdm.c
> +++ b/sound/soc/rockchip/rockchip_pdm.c

[ ... ]

> static void rockchip_pdm_remove(struct platform_device *pdev)
> {
> 	struct rk_pdm_dev *pdm = dev_get_drvdata(&pdev->dev);
> 
> 	pm_runtime_disable(&pdev->dev);
> 	if (!pm_runtime_status_suspended(&pdev->dev))
> 		rockchip_pdm_runtime_suspend(&pdev->dev);
> 
> 	clk_disable_unprepare(pdm->clk);

[Severity: High]
This is a pre-existing issue, but does this unconditional disable cause an
enable count underflow for pdm->clk?

In rockchip_pdm_probe(), pdm->clk is acquired but not enabled. It appears to
only be enabled dynamically via rockchip_pdm_runtime_resume(). During
rockchip_pdm_remove(), the driver correctly calls rockchip_pdm_runtime_suspend()
if the device is active, which disables the clock and drops its reference count
to 0.

However, calling clk_disable_unprepare() again immediately after would push
the reference count below zero, triggering a Common Clock Framework warning
in clk_core_disable(). Could this be repeatedly triggered via sysfs driver
unbind to cause a denial of service if panic_on_warn is set?

> 	clk_disable_unprepare(pdm->hclk);
> }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260602101608.45137-1-phucduc.bui@gmail.com?part=5

      reply	other threads:[~2026-06-02 13:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 10:16 [PATCH v2 0/5] ASoC: rockchip: Reorder clock enable sequence phucduc.bui
2026-06-02 10:16 ` [PATCH v2 1/5] ASoC: dt-bindings: rockchip-spdif: Correct SPDIF clock descriptions phucduc.bui
2026-06-02 10:16 ` [PATCH v2 2/5] ASoC: rockchip: spdif: Reorder clock enable sequence phucduc.bui
2026-06-02 10:36   ` sashiko-bot
2026-06-02 10:16 ` [PATCH v2 3/5] ASoC: rockchip: rockchip_pdm: " phucduc.bui
2026-06-02 10:45   ` sashiko-bot
2026-06-02 10:16 ` [PATCH v2 4/5] ASoC: rockchip: spdif: Restore regcache cache-only mode on sync failure phucduc.bui
2026-06-02 12:58   ` sashiko-bot
2026-06-02 10:16 ` [PATCH v2 5/5] ASoC: rockchip: rockchip_pdm: Handle runtime PM resume failures in set_fmt phucduc.bui
2026-06-02 13:09   ` 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=20260602130952.22F591F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=phucduc.bui@gmail.com \
    --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