[U-Boot] [PATCH 2/2] net: abort network initialization if the PHY driver fails
Tabi Timur-B04825
B04825 at freescale.com
Fri Jul 6 03:58:36 CEST 2012
Nobuhiro Iwamatsu wrote:
>> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
>> index eee41d7..7a3d16b 100644
>> --- a/drivers/net/fec_mxc.c
>> +++ b/drivers/net/fec_mxc.c
>> @@ -510,7 +510,12 @@ static int fec_open(struct eth_device *edev)
>> fec_eth_phy_config(edev);
>> if (fec->phydev) {
>> /* Start up the PHY */
>> - phy_startup(fec->phydev);
>> + int ret = phy_startup(fec->phydev);
>> + if (ret) {
>> + printf("Could not initialize PHY %s\n",
>> + fm_eth->phydev->dev->name);
>
> Probably this is fec, not fm_eth.
Thanks. I thought I was being diligent, and I ran MAKEALL, but I guess it
wasn't enough.
>> diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
>> index 7854a04..d777144 100644
>> --- a/drivers/net/xilinx_axi_emac.c
>> +++ b/drivers/net/xilinx_axi_emac.c
>> @@ -272,7 +272,11 @@ static int setup_phy(struct eth_device *dev)
>> phydev->advertising = phydev->supported;
>> priv->phydev = phydev;
>> phy_config(phydev);
>> - phy_startup(phydev);
>> + if (phy_startup(phydev)) {
>> + printf("axiemac: could not initialize PHY %s\n",
>> + phydev->dev->name);
>> + return 0;
>> + }
>>
>> switch (phydev->speed) {
>> case 1000:
>
> Why doesn't this driver use a ret variable?
> Other driver's patch used this.
Because setup_phy() returns either 0 (failure) or 1 (success).
--
Timur Tabi
Linux kernel developer at Freescale
More information about the U-Boot
mailing list