drivers: spi: 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
9456eca5c0
commit
d6776fe169
6 changed files with 30 additions and 0 deletions
|
@ -632,6 +632,11 @@ static int spi_mcux_configure(const struct device *dev,
|
|||
ctar_config->lastSckToPcsDelayInNanoSec = config->sck_pcs_delay;
|
||||
ctar_config->betweenTransferDelayInNanoSec = config->transfer_delay;
|
||||
|
||||
if (!device_is_ready(config->clock_dev)) {
|
||||
LOG_ERR("clock control device not ready");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (clock_control_get_rate(config->clock_dev, config->clock_subsys,
|
||||
&clock_freq)) {
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue