drivers: memc: 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
59fc838532
commit
9c626a07d4
|
@ -44,6 +44,11 @@ static int memc_stm32_init(const struct device *dev)
|
|||
/* enable FMC peripheral clock */
|
||||
clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
|
||||
|
||||
if (!device_is_ready(clk)) {
|
||||
LOG_ERR("clock control device not ready");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
r = clock_control_on(clk, (clock_control_subsys_t *)&config->pclken);
|
||||
if (r < 0) {
|
||||
LOG_ERR("Could not initialize FMC clock (%d)", r);
|
||||
|
|
Loading…
Reference in a new issue