]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clk: imx: fix integer overflow in AV PLL round rate
authorEmil Lundmark <emil@limesaudio.com>
Wed, 12 Oct 2016 10:31:40 +0000 (12:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Nov 2016 08:56:56 +0000 (09:56 +0100)
commit5f95e68daae39717df995c430f0ebc9ac51544bb
treea91eae8a5d74b696b4f6c63343368542a44838ed
parentfec43900c9b7607989a02dadc77cf57f483d9d2a
clk: imx: fix integer overflow in AV PLL round rate

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