diff --git a/include/zephyr/drivers/mdio.h b/include/zephyr/drivers/mdio.h index 687064acae..fe165bcb99 100644 --- a/include/zephyr/drivers/mdio.h +++ b/include/zephyr/drivers/mdio.h @@ -73,7 +73,9 @@ static inline void z_impl_mdio_bus_enable(const struct device *dev) const struct mdio_driver_api *api = (const struct mdio_driver_api *)dev->api; - api->bus_enable(dev); + if (api->bus_enable != NULL) { + api->bus_enable(dev); + } } /** @@ -89,7 +91,9 @@ static inline void z_impl_mdio_bus_disable(const struct device *dev) const struct mdio_driver_api *api = (const struct mdio_driver_api *)dev->api; - api->bus_disable(dev); + if (api->bus_disable != NULL) { + api->bus_disable(dev); + } } /**