diff --git a/drivers/net/ksz9477.c b/drivers/net/ksz9477.c index 561536ea77..0cbd404c65 100644 --- a/drivers/net/ksz9477.c +++ b/drivers/net/ksz9477.c @@ -387,6 +387,12 @@ int ksz9477_init(ksz9477_port_t master_port) ret = ksz9477_sgmii_write_indirect(KSZ9477_SGMII_AUTONEG_CONTROL, ®val16, 1); + if (ret != OK) + { + nerr("Failed to set SGMII port into PHY mode, ret %d\n", ret); + return ret ? ret : -EINVAL; + } + /* Write to autonegotiation advertisement register activates the new * setting. Advertise only full duplex. */ @@ -394,6 +400,12 @@ int ksz9477_init(ksz9477_port_t master_port) regval16 = SGMII_AUTONEG_ADVERTISE_FD; ret = ksz9477_sgmii_write_indirect(KSZ9477_SGMII_AUTONEG_ADVERTISE, ®val16, 1); + + if (ret != OK) + { + nerr("Failed to set autoneg, ret %d\n", ret); + return ret ? ret : -EINVAL; + } } /* Configure the static port-based VLANs */ @@ -413,6 +425,12 @@ int ksz9477_init(ksz9477_port_t master_port) g_port_vlan_config[i]); } + if (ret != OK) + { + nerr("Failed to configure VLANs, ret %d\n", ret); + return ret ? ret : -EINVAL; + } + #endif #ifdef CONFIG_NET_KSZ9477_PORT_SNIFF @@ -426,6 +444,12 @@ int ksz9477_init(ksz9477_port_t master_port) g_port_mirror_config[i]); } + if (ret != OK) + { + nerr("Failed to configure sniffer port, ret %d\n", ret); + return ret ? ret : -EINVAL; + } + #endif return ret;