diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2018-11-03 12:30:31 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:35:02 +0800 |
commit | 646d5918857a8b094b992b4d3418219f827d6463 (patch) | |
tree | a33ea17efcf5229d62bea402451cdb0627d7c7a4 /drivers/soc | |
parent | ed044f6d78156ae603dd732f15c5268d3f545605 (diff) |
MLK-20213-1 soc: imx: gpc: fix coverity issue
This patch fixes coverity issue of "divide by 0".
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r-- | drivers/soc/imx/gpc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c index c18f764045e3..792d8315603f 100644 --- a/drivers/soc/imx/gpc.c +++ b/drivers/soc/imx/gpc.c @@ -138,6 +138,11 @@ static void _imx6_pm_domain_power_on(struct generic_pm_domain *genpd) int i; u32 val, ipg_rate = clk_get_rate(ipg_clk); + if (ipg_rate == 0) { + WARN_ON(1); + return; + } + /* Enable reset clocks for all devices in the domain */ for (i = 0; i < pd->num_clks; i++) clk_prepare_enable(pd->clk[i]); @@ -187,6 +192,11 @@ static int imx6_pm_dispmix_on(struct generic_pm_domain *genpd) u32 ipg_rate = clk_get_rate(ipg_clk); int i; + if (ipg_rate == 0) { + WARN_ON(1); + return -EINVAL; + } + if ((cpu_is_imx6sl() && imx_get_soc_revision() >= IMX_CHIP_REVISION_1_2) || cpu_is_imx6sx()) { |