summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorBrian Masney <bmasney@redhat.com>2025-08-11 11:17:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-19 16:37:03 +0200
commit62fc9ae12ed0110d96abf784e7a375f0703d8182 (patch)
treeae05be2672b84a1e8b263ba2f02849329d7369ed /drivers/clk
parentfc2da4a15c3ef873ed8c3dd780cf9817f9f3f29e (diff)
downloadlinux-62fc9ae12ed0110d96abf784e7a375f0703d8182.tar.gz
linux-62fc9ae12ed0110d96abf784e7a375f0703d8182.tar.bz2
linux-62fc9ae12ed0110d96abf784e7a375f0703d8182.zip
clk: at91: peripheral: fix return value
[ Upstream commit 47b13635dabc14f1c2fdcaa5468b47ddadbdd1b5 ] determine_rate() is expected to return an error code, or 0 on success. clk_sam9x5_peripheral_determine_rate() has a branch that returns the parent rate on a certain case. This is the behavior of round_rate(), so let's go ahead and fix this by setting req->rate. Fixes: b4c115c76184f ("clk: at91: clk-peripheral: add support for changeable parent rate") Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/at91/clk-peripheral.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
index c173a44c800a..629f050a855a 100644
--- a/drivers/clk/at91/clk-peripheral.c
+++ b/drivers/clk/at91/clk-peripheral.c
@@ -279,8 +279,11 @@ static int clk_sam9x5_peripheral_determine_rate(struct clk_hw *hw,
long best_diff = LONG_MIN;
u32 shift;
- if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max)
- return parent_rate;
+ if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) {
+ req->rate = parent_rate;
+
+ return 0;
+ }
/* Fist step: check the available dividers. */
for (shift = 0; shift <= PERIPHERAL_MAX_SHIFT; shift++) {