linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.14 01/25] clk: at91: generated: Truncate divisor to GENERATED_MAX_DIV + 1
@ 2019-08-06 21:35 Sasha Levin
  2019-08-06 21:35 ` [PATCH AUTOSEL 4.14 02/25] clk: renesas: cpg-mssr: Fix reset control race condition Sasha Levin
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: Sasha Levin @ 2019-08-06 21:35 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Codrin Ciubotariu, Nicolas Ferre, Ludovic Desroches,
	Stephen Boyd, Sasha Levin, linux-clk

From: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>

[ Upstream commit 1573eebeaa8055777eb753f9b4d1cbe653380c38 ]

In clk_generated_determine_rate(), if the divisor is greater than
GENERATED_MAX_DIV + 1, then the wrong best_rate will be returned.
If clk_generated_set_rate() will be called later with this wrong
rate, it will return -EINVAL, so the generated clock won't change
its value. Do no let the divisor be greater than GENERATED_MAX_DIV + 1.

Fixes: 8c7aa6328947 ("clk: at91: clk-generated: remove useless divisor loop")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/at91/clk-generated.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index 33481368740e7..113152425a95d 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -153,6 +153,8 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
 			continue;
 
 		div = DIV_ROUND_CLOSEST(parent_rate, req->rate);
+		if (div > GENERATED_MAX_DIV + 1)
+			div = GENERATED_MAX_DIV + 1;
 
 		clk_generated_best_diff(req, parent, parent_rate, div,
 					&best_diff, &best_rate);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-08-06 21:41 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06 21:35 [PATCH AUTOSEL 4.14 01/25] clk: at91: generated: Truncate divisor to GENERATED_MAX_DIV + 1 Sasha Levin
2019-08-06 21:35 ` [PATCH AUTOSEL 4.14 02/25] clk: renesas: cpg-mssr: Fix reset control race condition Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 03/25] xtensa: fix build for cores with coprocessors Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 04/25] xen/pciback: remove set but not used variable 'old_state' Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 05/25] irqchip/gic-v3-its: Free unused vpt_page when alloc vpe table fail Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 06/25] irqchip/irq-imx-gpcv2: Forward irq type to parent Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 07/25] perf header: Fix divide by zero error if f_header.attr_size==0 Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 08/25] perf header: Fix use of unitialized value warning Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 09/25] libata: zpodd: Fix small read overflow in zpodd_get_mech_type() Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 10/25] drm/bridge: lvds-encoder: Fix build error while CONFIG_DRM_KMS_HELPER=m Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 11/25] scsi: hpsa: correct scsi command status issue after reset Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 12/25] scsi: qla2xxx: Fix possible fcport null-pointer dereferences Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 13/25] exit: make setting exit_state consistent Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 14/25] ata: libahci: do not complain in case of deferred probe Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 15/25] kbuild: modpost: handle KBUILD_EXTRA_SYMBOLS only for external modules Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 16/25] arm64/efi: fix variable 'si' set but not used Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 17/25] drm/vgem: fix cache synchronization on arm/arm64 Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 18/25] arm64: unwind: Prohibit probing on return_address() Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 19/25] arm64/mm: fix variable 'pud' set but not used Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 20/25] IB/core: Add mitigation for Spectre V1 Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 21/25] IB/mad: Fix use-after-free in ib mad completion handling Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 22/25] drm: msm: Fix add_gpu_components Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 23/25] ocfs2: remove set but not used variable 'last_hash' Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 24/25] coredump: split pipe command whitespace before expanding template Sasha Levin
2019-08-06 21:36 ` [PATCH AUTOSEL 4.14 25/25] asm-generic: fix -Wtype-limits compiler warnings Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).