Re: [PATCH v2 3/9] usb: chipidea: usb2: use devm_clk_get_optional_enabled()
From: Junzhong Pan <hidden>
Date: 2026-09-08 10:03:20
Also in:
linux-devicetree, linux-riscv, lkml, spacemit
On 9/8/2026 5:55 PM, sashiko-bot@kernel.org wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Double disable and unprepare of the clock during device removal. -- commit d2e0018bd6f14cd49dfa6012d83048e3abde69f6 Author: Junzhong Pan [off-list ref] usb: chipidea: usb2: use devm_clk_get_optional_enabled() Convert devm_clk_get_optional() and clk_prepare_enable() into a single call devm_clk_get_optional_enabled().quoted
diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c index 8ffa1e95d8e86..6fae2d4a053a1 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c[ ... ]quoted
@@ -99,10 +94,6 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) pm_runtime_enable(dev); return 0; - -clk_err: - clk_disable_unprepare(priv->clk); - return ret; } static void ci_hdrc_usb2_remove(struct platform_device *pdev)[Severity: High] Does this conversion also require removing the manual cleanup in ci_hdrc_usb2_remove()? Since the clock is now managed by devm_clk_get_optional_enabled(), it will automatically handle disabling and unpreparing the clock when the device is removed. Leaving the manual clk_disable_unprepare(priv->clk) in ci_hdrc_usb2_remove(): static void ci_hdrc_usb2_remove(struct platform_device *pdev) { struct ci_hdrc_usb2_priv *priv = platform_get_drvdata(pdev); pm_runtime_disable(&pdev->dev); ci_hdrc_remove_device(priv->ci_pdev); clk_disable_unprepare(priv->clk); } appears to result in a double disable and unprepare of the clock during device removal, which could lead to unbalanced reference counts and trigger kernel warnings.
Ok, I will fix this in v3. Thanks.