[PATCH v2] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback

Akhilesh Patil posted 1 patch 2 months, 2 weeks ago
drivers/clk/spacemit/ccu_pll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback
Posted by Akhilesh Patil 2 months, 2 weeks ago
Return 0 instead of -EINVAL if function ccu_pll_recalc_rate() fails to
get correct rate entry. Follow .recalc_rate callback documentation
as mentioned in include/linux/clk-provider.h for error return value.

Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC")
Reviewed-by: Haylen Chu <heylenay@4d2.org>
Reviewed-by: Alex Elder <elder@riscstar.com>
---
v1 --> v2: 
  - Add missing Fixes: tag
  - Carry forward Reviewed-by tags
---
 drivers/clk/spacemit/ccu_pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/spacemit/ccu_pll.c b/drivers/clk/spacemit/ccu_pll.c
index 4427dcfbbb97..45f540073a65 100644
--- a/drivers/clk/spacemit/ccu_pll.c
+++ b/drivers/clk/spacemit/ccu_pll.c
@@ -122,7 +122,7 @@ static unsigned long ccu_pll_recalc_rate(struct clk_hw *hw,
 
 	WARN_ON_ONCE(!entry);
 
-	return entry ? entry->rate : -EINVAL;
+	return entry ? entry->rate : 0;
 }
 
 static long ccu_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-- 
2.34.1
Re: [PATCH v2] clk: spacemit: ccu_pll: fix error return value in recalc_rate callback
Posted by Stephen Boyd 2 months, 1 week ago
Quoting Akhilesh Patil (2025-07-22 22:29:56)
> Return 0 instead of -EINVAL if function ccu_pll_recalc_rate() fails to
> get correct rate entry. Follow .recalc_rate callback documentation
> as mentioned in include/linux/clk-provider.h for error return value.
> 
> Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
> Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC")
> Reviewed-by: Haylen Chu <heylenay@4d2.org>
> Reviewed-by: Alex Elder <elder@riscstar.com>
> ---

Applied to clk-next