diff --git a/drivers/ethernet/eth_esp32.c b/drivers/ethernet/eth_esp32.c index 689a6db7824..d7ae632bf9c 100644 --- a/drivers/ethernet/eth_esp32.c +++ b/drivers/ethernet/eth_esp32.c @@ -212,8 +212,9 @@ int eth_esp32_initialize(const struct device *dev) clock_control_subsys_t clock_subsys = (clock_control_subsys_t)DT_CLOCKS_CELL(DT_NODELABEL(eth), offset); + /* clock is shared, so do not bail out if already enabled */ res = clock_control_on(clock_dev, clock_subsys); - if (res != 0) { + if (res < 0 && res != -EALREADY) { goto err; } diff --git a/drivers/mdio/mdio_esp32.c b/drivers/mdio/mdio_esp32.c index 8e3e073bba0..b4c1a70f19a 100644 --- a/drivers/mdio/mdio_esp32.c +++ b/drivers/mdio/mdio_esp32.c @@ -104,8 +104,9 @@ static int mdio_esp32_initialize(const struct device *dev) clock_control_subsys_t clock_subsys = (clock_control_subsys_t)DT_CLOCKS_CELL(DT_NODELABEL(mdio), offset); + /* clock is shared, so do not bail out if already enabled */ res = clock_control_on(clock_dev, clock_subsys); - if (res != 0) { + if (res < 0 && res != -EALREADY) { goto err; }