i3c: dw: fix APB clock name
Subsystems (2)
PATCH 1/1 i3c: dw: fix APB clock name
The dt-binding doc says the APB clock name is "apb", but the code uses "pclk". Since the dt-binding is an ABI, we can only fix this mismatch by fixing the code.
--- drivers/i3c/master/dw-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/dw-i3c-master.c +1 -1
@@ -1579,7 +1579,7 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,if (IS_ERR (master->core_clk))return PTR_ERR (master->core_clk); - master->pclk =devm_clk_get_optional_enabled (&pdev->dev,"pclk" ); + master->pclk =devm_clk_get_optional_enabled (&pdev->dev,"apb" );if (IS_ERR (master->pclk))return PTR_ERR (master->pclk);
Signature · 1 line
2.53.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the return value of dw_i3c_master_enable_clks() is ignored in dw_i3c_master_runtime_resume(). --
--- Patch [1]: [PATCH] i3c: dw: fix APB clock name --- commit 686892a7f9278958827b79c6f3b4b10f19a623b2
Author: Jisheng Zhang <[email protected]>
i3c: dw: fix APB clock name
This commit fixes a mismatch between the APB clock name in the code and the device tree bindings. It changes the clock name requested by the driver from pclk to apb to match the ABI.
drivers/i3c/master/dw-i3c-master.c int dw_i3c_common_probe(struct dw_i3c_master *master, · line 1582
Quoted 10 lines
drivers/i3c/master/dw-i3c-master.c +1
-1@@ -1579,7 +1579,7 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,if (IS_ERR (master->core_clk))return PTR_ERR (master->core_clk); - master->pclk =devm_clk_get_optional_enabled (&pdev->dev,"pclk" ); + master->pclk =devm_clk_get_optional_enabled (&pdev->dev,"apb" );
[Severity: High]
This isn't a bug introduced by this patch, but since we are modifying clock handling here, does dw_i3c_master_runtime_resume() need to check the return value of dw_i3c_master_enable_clks()?
In drivers/i3c/master/dw-i3c-master.c:dw_i3c_master_runtime_resume():
pinctrl_pm_select_default_state(dev); dw_i3c_master_enable_clks(master); reset_control_deassert(master->core_rst);
If the clock framework fails to enable the clocks during runtime resume, dw_i3c_master_enable_clks() will return a negative error code. This is currently ignored, and the driver proceeds to deassert the reset and access hardware registers.
Can this lead to an unrecoverable bus fault or system crash if the registers are accessed without an active clock?
Quoted 3 lines
drivers/i3c/master/dw-i3c-master.c +0
-0if (IS_ERR (master->pclk))return PTR_ERR (master->pclk);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 3 lines · Jisheng Zhang
The dt-binding doc says the APB clock name is "apb", but the code uses "pclk". Since the dt-binding is an ABI, we can only fix this mismatch by fixing the code.
i3c: dw: rename "pclk" to "apb" to match dt-binding
Change clock name "pclk" to "apb" to match dt-binding doc. No upstream device tree sources currently use the "pclk" clock name, so no any backward compatibility issues.
Not sure what happen when apply patch a0d48ebf39ce. Anyways, thanks for fix it.
Frank
Quoted 23 lines
Fixes a0d48ebf39ce ("i3c: dw: Add optional apb clock")Signed-off-by Jisheng Zhang <[email protected]>--- drivers/i3c/master/dw-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i3c/master/dw-i3c-master.c +1
-2@@ -1579,7 +1579,7 @@ int dw_i3c_common_probe(struct dw_i3c_master *master,if (IS_ERR (master->core_clk))return PTR_ERR (master->core_clk); - master->pclk =devm_clk_get_optional_enabled (&pdev->dev,"pclk" ); + master->pclk =devm_clk_get_optional_enabled (&pdev->dev,"apb" );if (IS_ERR (master->pclk))return PTR_ERR (master->pclk); --2.53.0