Set denominator to 1 if it is 0 in the init phase.

This prevents panic and also helps when the clocks
become available later.
This is based on comment from manu@ on
https://reviews.freebsd.org/D31299
This commit is contained in:
Ganbold Tsagaankhuu 2022-10-01 02:01:59 +00:00
parent f341e9bad3
commit 8eb94b238f

View File

@ -150,6 +150,8 @@ rk_clk_fract_init(struct clknode *clk, device_t dev)
sc->numerator = (reg >> 16) & 0xFFFF;
sc->denominator = reg & 0xFFFF;
if (sc->denominator == 0)
sc->denominator = 1;
clknode_init_parent_idx(clk, 0);
return(0);