drivers: dma: 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
31681269c0
commit
dc0b907f4b
|
@ -616,6 +616,11 @@ static int dma_stm32_init(const struct device *dev)
|
|||
const struct dma_stm32_config *config = dev->config;
|
||||
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 *) &config->pclken) != 0) {
|
||||
LOG_ERR("clock op failed\n");
|
||||
|
|
|
@ -216,6 +216,11 @@ static int dmamux_stm32_init(const struct device *dev)
|
|||
const struct dmamux_stm32_config *config = dev->config;
|
||||
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 *) &config->pclken) != 0) {
|
||||
LOG_ERR("clock op failed\n");
|
||||
|
|
Loading…
Reference in a new issue