Handle failure to enable the clock or obtain its frequency.

This commit is contained in:
Ian Lepore 2019-06-15 16:59:03 +00:00
parent 1bf4afc527
commit 4d7ef8a2be
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349060

View File

@ -150,8 +150,16 @@ aw_pwm_attach(device_t dev)
goto fail;
}
error = clk_enable(sc->clk);
if (error != 0) {
device_printf(dev, "cannot enable clock\n");
goto fail;
}
error = clk_get_freq(sc->clk, &sc->clk_freq);
if (error != 0) {
device_printf(dev, "cannot get clock frequency\n");
goto fail;
}
if (bus_alloc_resources(dev, aw_pwm_spec, &sc->res) != 0) {
device_printf(dev, "cannot allocate resources for device\n");