summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-01-17 16:02:56 +0100
committerStephen Boyd <sboyd@kernel.org>2018-03-16 23:40:41 +0100
commit93abad369a44f3b68f0581a00c4608500f293d93 (patch)
treeca96e17a9bfa0229edc1e3b88310252c25aa5edb /drivers
parentMerge tag 'clk-imx-4.17-misc' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff)
downloadlinux-93abad369a44f3b68f0581a00c4608500f293d93.tar.xz
linux-93abad369a44f3b68f0581a00c4608500f293d93.zip
clk: imx: pllv2: avoid using uninitialized values
Forward the errors returned by __clk_pllv2_set_rate() in the recalc rate function, to avoid using uninitialized values for the rate calculation. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/imx/clk-pllv2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/clk/imx/clk-pllv2.c b/drivers/clk/imx/clk-pllv2.c
index 85b5cbe9744c..eeba3cb14e2d 100644
--- a/drivers/clk/imx/clk-pllv2.c
+++ b/drivers/clk/imx/clk-pllv2.c
@@ -182,8 +182,12 @@ static long clk_pllv2_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
u32 dp_op, dp_mfd, dp_mfn;
+ int ret;
+
+ ret = __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
+ if (ret)
+ return ret;
- __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
return __clk_pllv2_recalc_rate(*prate, MXC_PLL_DP_CTL_DPDCK0_2_EN,
dp_op, dp_mfd, dp_mfn);
}