diff options
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 993c52c82aeb..ff109fe5af6b 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -442,11 +442,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
442 | u32 flags, phy_interface_t interface) | 442 | u32 flags, phy_interface_t interface) |
443 | { | 443 | { |
444 | struct device *d = &phydev->dev; | 444 | struct device *d = &phydev->dev; |
445 | int err; | ||
445 | 446 | ||
446 | /* Assume that if there is no driver, that it doesn't | 447 | /* Assume that if there is no driver, that it doesn't |
447 | * exist, and we should use the genphy driver. */ | 448 | * exist, and we should use the genphy driver. */ |
448 | if (NULL == d->driver) { | 449 | if (NULL == d->driver) { |
449 | int err; | ||
450 | d->driver = &genphy_driver.driver; | 450 | d->driver = &genphy_driver.driver; |
451 | 451 | ||
452 | err = d->driver->probe(d); | 452 | err = d->driver->probe(d); |
@@ -474,7 +474,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
474 | /* Do initial configuration here, now that | 474 | /* Do initial configuration here, now that |
475 | * we have certain key parameters | 475 | * we have certain key parameters |
476 | * (dev_flags and interface) */ | 476 | * (dev_flags and interface) */ |
477 | return phy_init_hw(phydev); | 477 | err = phy_init_hw(phydev); |
478 | if (err) | ||
479 | phy_detach(phydev); | ||
480 | |||
481 | return err; | ||
478 | } | 482 | } |
479 | 483 | ||
480 | /** | 484 | /** |
@@ -534,7 +538,7 @@ EXPORT_SYMBOL(phy_detach); | |||
534 | /* Generic PHY support and helper functions */ | 538 | /* Generic PHY support and helper functions */ |
535 | 539 | ||
536 | /** | 540 | /** |
537 | * genphy_config_advert - sanitize and advertise auto-negotation parameters | 541 | * genphy_config_advert - sanitize and advertise auto-negotiation parameters |
538 | * @phydev: target phy_device struct | 542 | * @phydev: target phy_device struct |
539 | * | 543 | * |
540 | * Description: Writes MII_ADVERTISE with the appropriate values, | 544 | * Description: Writes MII_ADVERTISE with the appropriate values, |
@@ -683,7 +687,7 @@ int genphy_config_aneg(struct phy_device *phydev) | |||
683 | return result; | 687 | return result; |
684 | 688 | ||
685 | if (result == 0) { | 689 | if (result == 0) { |
686 | /* Advertisment hasn't changed, but maybe aneg was never on to | 690 | /* Advertisement hasn't changed, but maybe aneg was never on to |
687 | * begin with? Or maybe phy was isolated? */ | 691 | * begin with? Or maybe phy was isolated? */ |
688 | int ctl = phy_read(phydev, MII_BMCR); | 692 | int ctl = phy_read(phydev, MII_BMCR); |
689 | 693 | ||