drivers: i2s: 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
e84636d010
commit
2e1f25f355
3 changed files with 11 additions and 1 deletions
|
@ -102,6 +102,11 @@ static int i2s_stm32_enable_clock(const struct device *dev)
|
|||
|
||||
clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
|
||||
|
||||
if (!device_is_ready(clk)) {
|
||||
LOG_ERR("clock control device not ready");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = clock_control_on(clk, (clock_control_subsys_t *) &cfg->pclken);
|
||||
if (ret != 0) {
|
||||
LOG_ERR("Could not enable I2S clock");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue