drivers: dac: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
987ec97663
commit
d4a2f316cb
1 changed files with 5 additions and 0 deletions
|
@ -121,6 +121,11 @@ static int dac_stm32_init(const struct device *dev)
|
|||
/* enable clock for subsystem */
|
||||
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
|
||||
|
||||
if (!device_is_ready(clk)) {
|
||||
LOG_ERR("clock control device not ready");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (clock_control_on(clk,
|
||||
(clock_control_subsys_t *) &cfg->pclken) != 0) {
|
||||
return -EIO;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue