Skip to content

Commit 18a8d82

Browse files
masneybgregkh
authored andcommitted
clk: at91: peripheral: fix return value
[ Upstream commit 47b1363 ] 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: b4c115c ("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>
1 parent 2fe5844 commit 18a8d82

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/clk/at91/clk-peripheral.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,11 @@ static int clk_sam9x5_peripheral_determine_rate(struct clk_hw *hw,
279279
long best_diff = LONG_MIN;
280280
u32 shift;
281281

282-
if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max)
283-
return parent_rate;
282+
if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) {
283+
req->rate = parent_rate;
284+
285+
return 0;
286+
}
284287

285288
/* Fist step: check the available dividers. */
286289
for (shift = 0; shift <= PERIPHERAL_MAX_SHIFT; shift++) {

0 commit comments

Comments
 (0)