drivers: can: 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
68230cb1a7
commit
035c7d2190
6 changed files with 35 additions and 3 deletions
|
@ -46,6 +46,11 @@ static int mcux_mcan_init(const struct device *dev)
|
|||
const struct mcux_mcan_config *mcux_config = mcan_config->custom;
|
||||
int err;
|
||||
|
||||
if (!device_is_ready(mcux_config->clock_dev)) {
|
||||
LOG_ERR("clock control device not ready");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
err = pinctrl_apply_state(mcux_config->pincfg, PINCTRL_STATE_DEFAULT);
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue