All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] video: ipu: Use lldiv() for 64-bit division in ipu_pixel_clk_set_rate()
@ 2016-05-19  9:48 Andrew Shadura
  0 siblings, 0 replies; only message in thread
From: Andrew Shadura @ 2016-05-19  9:48 UTC (permalink / raw)
  To: u-boot

Fix compilation problems with a hardfloat toolchain on ARM
(libgcc.a(_udivmoddi4.o) uses VFP register arguments, u-boot does not).

Cast clk->parent->rate to u64 before the multiplication to avoid
overflowing a 32-bit value.

Bug introduced by 3cb4f25cc702db17455583599d0940c81337a17a.

Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
---
 drivers/video/ipu_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 36d4b23..dad3e6f 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -352,7 +352,7 @@ static int ipu_pixel_clk_set_rate(struct clk *clk, unsigned long rate)
 	 */
 	__raw_writel((div / 16) << 16, DI_BS_CLKGEN1(clk->id));
 
-	clk->rate = (u64)(clk->parent->rate * 16) / div;
+	clk->rate = lldiv((u64)clk->parent->rate * 16, div);
 
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-19  9:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19  9:48 [U-Boot] [PATCH] video: ipu: Use lldiv() for 64-bit division in ipu_pixel_clk_set_rate() Andrew Shadura

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.