drivers: intc: 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
2e1f25f355
commit
5a7eb0ccfc
2 changed files with 8 additions and 0 deletions
|
@ -515,6 +515,10 @@ static int xec_ecia_init(const struct device *dev)
|
|||
uint32_t n = 0, nr = 0;
|
||||
int ret;
|
||||
|
||||
if (!device_is_ready(clk_dev)) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = clock_control_on(clk_dev,
|
||||
(clock_control_subsys_t *)&cfg->clk_ctrl);
|
||||
if (ret < 0) {
|
||||
|
|
|
@ -154,6 +154,10 @@ static int rv32m1_intmux_init(const struct device *dev)
|
|||
INTMUX_Type *regs = DEV_REGS(dev);
|
||||
size_t i;
|
||||
|
||||
if (!device_is_ready(config->clock_dev)) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Enable INTMUX clock. */
|
||||
clock_control_on(config->clock_dev, config->clock_subsys);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue