On reset register value 0x20000000 for some plls of g12, there are
divide by zero operations warned by UBSAN. For the case, calculate
pll rate as zero.
This removes below UBSAN warnings:
UBSAN: Undefined behaviour in drivers/amlogic/clk/g12a/g12a_clk-pll.c:155:74
...
UBSAN: Undefined behaviour in drivers/amlogic/clk/g12a/g12a_clk-pll.c:140:74
...
UBSAN: Undefined behaviour in drivers/amlogic/clk/g12a/g12a_clk-pll.c:145:25
division by zero
...
[<
ffffff9009b8de04>] __ubsan_handle_divrem_overflow+0x8c/0xc8
[<
ffffff900a37f140>] meson_g12a_pll_recalc_rate+0x8d0/0x930
[<
ffffff9009c4909c>] clk_register+0x724/0xe10
[<
ffffff900bab2fec>] g12a_clkc_init+0x640/0x7fc
...
Change-Id: I4f0c771502e2ae0291a9eaffbea7a03e617009af
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
p = &pll->frac;
- if (p->width >= 2) {
+ if (!n) {
+ rate_mhz = 0;
+ } else if (p->width >= 2) {
reg = readl(pll->base + p->reg_off);
frac = PARM_GET(p->width - 1, p->shift, reg);