From: 陈亮 Date: Wed, 18 Jun 2014 12:15:42 +0000 (-0700) Subject: ddr_freq: fix Division by zero in kernel X-Git-Tag: firefly_0821_release~5071 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1b8f13ca4cbf3fbd532419f8c31618c81adffa3a;p=firefly-linux-kernel-4.4.55.git ddr_freq: fix Division by zero in kernel --- diff --git a/arch/arm/mach-rockchip/ddr_freq.c b/arch/arm/mach-rockchip/ddr_freq.c index a68c703b6807..2cf82297e646 100644 --- a/arch/arm/mach-rockchip/ddr_freq.c +++ b/arch/arm/mach-rockchip/ddr_freq.c @@ -282,6 +282,8 @@ void ddr_bandwidth_get(struct ddr_bw_info *ddr_bw_ch0, struct ddr_bw_info *ddr_b ddr_bw_val[j][i] = grf_readl(RK3288_GRF_SOC_STATUS11+i*4+j*16); } } + if (!ddr_bw_val[0][ddrbw_time_num]) + goto end; if (ddr_bw_ch0) { ddr_freq = readl_relaxed(RK_DDR_VIRT + 0xc0); @@ -320,7 +322,7 @@ void ddr_bandwidth_get(struct ddr_bw_info *ddr_bw_ch0, struct ddr_bw_info *ddr_b ddr_bw_ch0->vio1 = ddr_bw_ch0->vio1*ddr_freq/ddr_bw_val[0][ddrbw_time_num]; ddr_bw_ch0->vio2 = ddr_bw_ch0->vio2*ddr_freq/ddr_bw_val[0][ddrbw_time_num]; } - +end: ddr_monitor_start(); }