mirror of
https://github.com/apache/nuttx.git
synced 2026-05-13 10:38:40 +08:00
drivers/net/ksz9477.c: Check return values in init
Check that writes to configuration registers success. Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
This commit is contained in:
committed by
Xiang Xiao
parent
0641e6f287
commit
e1fb0b30c4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user