* Patch "clk: imx: fix integer overflow in AV PLL round rate" has been added to the 4.8-stable tree
@ 2016-11-21 16:29 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-11-21 16:29 UTC (permalink / raw)
To: emil, b20788, fabio.estevam, gregkh, sboyd, shawnguo
Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
clk: imx: fix integer overflow in AV PLL round rate
to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
clk-imx-fix-integer-overflow-in-av-pll-round-rate.patch
and it can be found in the queue-4.8 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From 5c2f117a22e46a4afee6ddee29b653a7a2a6b41f Mon Sep 17 00:00:00 2001
From: Emil Lundmark <emil@limesaudio.com>
Date: Wed, 12 Oct 2016 12:31:40 +0200
Subject: clk: imx: fix integer overflow in AV PLL round rate
From: Emil Lundmark <emil@limesaudio.com>
commit 5c2f117a22e46a4afee6ddee29b653a7a2a6b41f upstream.
Since 'parent_rate * mfn' may overflow 32 bits, the result should be
stored using 64 bits.
The problem was discovered when trying to set the rate of the audio PLL
(pll4_post_div) on an i.MX6Q. The desired rate was 196.608 MHz, but
the actual rate returned was 192.000570 MHz. The round rate function should
have been able to return 196.608 MHz, i.e., the desired rate.
Fixes: ba7f4f557eb6 ("clk: imx: correct AV PLL rate formula")
Cc: Anson Huang <b20788@freescale.com>
Signed-off-by: Emil Lundmark <emil@limesaudio.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/clk/imx/clk-pllv3.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/clk/imx/clk-pllv3.c
+++ b/drivers/clk/imx/clk-pllv3.c
@@ -223,7 +223,7 @@ static unsigned long clk_pllv3_av_recalc
temp64 *= mfn;
do_div(temp64, mfd);
- return (parent_rate * div) + (u32)temp64;
+ return parent_rate * div + (unsigned long)temp64;
}
static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate,
@@ -247,7 +247,11 @@ static long clk_pllv3_av_round_rate(stru
do_div(temp64, parent_rate);
mfn = temp64;
- return parent_rate * div + parent_rate * mfn / mfd;
+ temp64 = (u64)parent_rate;
+ temp64 *= mfn;
+ do_div(temp64, mfd);
+
+ return parent_rate * div + (unsigned long)temp64;
}
static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
Patches currently in stable-queue which might be from emil@limesaudio.com are
queue-4.8/clk-imx-fix-integer-overflow-in-av-pll-round-rate.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-21 16:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21 16:29 Patch "clk: imx: fix integer overflow in AV PLL round rate" has been added to the 4.8-stable tree gregkh
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.