From: "Li Youhong" <dayou5941@163.com>
To: biju.das.jz@bp.renesas.com, wbg@kernel.org
Cc: linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Li Youhong <liyouhong@kylinos.cn>
Subject: [PATCH v2 1/3] counter: rz-mtu3-cnt: check clk_prepare_enable() and pm_runtime_set_active()
Date: Mon, 31 Aug 2026 13:44:05 +0800 [thread overview]
Message-ID: <20260831054407.1695146-2-dayou5941@163.com> (raw)
In-Reply-To: <20260831054407.1695146-1-dayou5941@163.com>
From: Li Youhong <liyouhong@kylinos.cn>
The driver ignored clk_prepare_enable() failures during probe and
runtime resume, and ignored pm_runtime_set_active() failures during
probe. Propagate the errors so probe does not continue with the clock
disabled or an inconsistent runtime PM state, and resume does not
report success falsely.
Fixes: 0be8907359df ("counter: Add Renesas RZ/G2L MTU3a counter driver")
Suggested-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
---
drivers/counter/rz-mtu3-cnt.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c
index 7bfb6979193c..3654e0fdab20 100644
--- a/drivers/counter/rz-mtu3-cnt.c
+++ b/drivers/counter/rz-mtu3-cnt.c
@@ -817,9 +817,7 @@ static int rz_mtu3_cnt_pm_runtime_resume(struct device *dev)
{
struct clk *const clk = dev_get_drvdata(dev);
- clk_prepare_enable(clk);
-
- return 0;
+ return clk_prepare_enable(clk);
}
static DEFINE_RUNTIME_DEV_PM_OPS(rz_mtu3_cnt_pm_ops,
@@ -861,8 +859,14 @@ static int rz_mtu3_cnt_probe(struct platform_device *pdev)
mutex_init(&priv->lock);
platform_set_drvdata(pdev, priv->clk);
- clk_prepare_enable(priv->clk);
- pm_runtime_set_active(&pdev->dev);
+ ret = clk_prepare_enable(priv->clk);
+ if (ret)
+ return ret;
+
+ ret = pm_runtime_set_active(&pdev->dev);
+ if (ret)
+ goto disable_clock;
+
pm_runtime_enable(&pdev->dev);
ret = devm_add_action_or_reset(&pdev->dev, rz_mtu3_cnt_pm_disable, dev);
if (ret < 0)
--
2.25.1
next prev parent reply other threads:[~2026-08-31 5:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 5:44 [PATCH v2 0/3] counter: rz-mtu3-cnt: check clock and runtime PM errors Li Youhong
2026-08-31 5:44 ` Li Youhong [this message]
2026-08-31 5:44 ` [PATCH v2 2/3] counter: rz-mtu3-cnt: check pm_runtime_get_sync() return values Li Youhong
2026-09-03 6:53 ` Biju Das
2026-09-03 7:06 ` 李佑鸿
2026-08-31 5:44 ` [PATCH v2 3/3] counter: rz-mtu3-cnt: put runtime PM ref if counter init fails Li Youhong
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=20260831054407.1695146-2-dayou5941@163.com \
--to=dayou5941@163.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=liyouhong@kylinos.cn \
--cc=wbg@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox