]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: at91: peripheral: fix return value
authorBrian Masney <bmasney@redhat.com>
Mon, 11 Aug 2025 15:17:53 +0000 (11:17 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:23:05 +0000 (16:23 +0200)
[ 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>
drivers/clk/at91/clk-peripheral.c

index 5104d4025484c825e5a58857e78012d704d41638..a5e8f5949d770b9a239ab3b8dccaf2217a019c06 100644 (file)
@@ -275,8 +275,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++) {