Call airoha_switch_init() before creating GDM instances, so if allocation of GDM port fails, early created GDM instances will work normally.
Signed-off-by: Mikhail Kshevetskiy <[email protected]> --- drivers/net/airoha_eth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c index b1256866046..7f984f56dc8 100644 --- a/drivers/net/airoha_eth.c +++ b/drivers/net/airoha_eth.c @@ -861,6 +861,10 @@ static int airoha_eth_probe(struct udevice *dev) if (ret) return ret; + ret = airoha_switch_init(dev, eth); + if (ret) + return ret; + ofnode_for_each_subnode(node, dev_ofnode(dev)) { if (!ofnode_device_is_compatible(node, "airoha,eth-mac")) continue; @@ -873,7 +877,7 @@ static int airoha_eth_probe(struct udevice *dev) return ret; } - return airoha_switch_init(dev, eth); + return 0; } static int airoha_eth_port_of_to_plat(struct udevice *dev) -- 2.51.0

