| .. | .. |
|---|
| 2891 | 2891 | if (phydrv->flags & PHY_IS_INTERNAL) |
|---|
| 2892 | 2892 | phydev->is_internal = true; |
|---|
| 2893 | 2893 | |
|---|
| 2894 | | - mutex_lock(&phydev->lock); |
|---|
| 2895 | | - |
|---|
| 2896 | 2894 | /* Deassert the reset signal */ |
|---|
| 2897 | 2895 | phy_device_reset(phydev, 0); |
|---|
| 2898 | 2896 | |
|---|
| .. | .. |
|---|
| 2961 | 2959 | phydev->state = PHY_READY; |
|---|
| 2962 | 2960 | |
|---|
| 2963 | 2961 | out: |
|---|
| 2964 | | - /* Assert the reset signal */ |
|---|
| 2962 | + /* Re-assert the reset signal on error */ |
|---|
| 2965 | 2963 | if (err) |
|---|
| 2966 | 2964 | phy_device_reset(phydev, 1); |
|---|
| 2967 | | - |
|---|
| 2968 | | - mutex_unlock(&phydev->lock); |
|---|
| 2969 | 2965 | |
|---|
| 2970 | 2966 | return err; |
|---|
| 2971 | 2967 | } |
|---|
| .. | .. |
|---|
| 2976 | 2972 | |
|---|
| 2977 | 2973 | cancel_delayed_work_sync(&phydev->state_queue); |
|---|
| 2978 | 2974 | |
|---|
| 2979 | | - mutex_lock(&phydev->lock); |
|---|
| 2980 | 2975 | phydev->state = PHY_DOWN; |
|---|
| 2981 | | - mutex_unlock(&phydev->lock); |
|---|
| 2982 | 2976 | |
|---|
| 2983 | 2977 | sfp_bus_del_upstream(phydev->sfp_bus); |
|---|
| 2984 | 2978 | phydev->sfp_bus = NULL; |
|---|
| .. | .. |
|---|
| 3088 | 3082 | { |
|---|
| 3089 | 3083 | int rc; |
|---|
| 3090 | 3084 | |
|---|
| 3085 | + ethtool_set_ethtool_phy_ops(&phy_ethtool_phy_ops); |
|---|
| 3086 | + |
|---|
| 3091 | 3087 | rc = mdio_bus_init(); |
|---|
| 3092 | 3088 | if (rc) |
|---|
| 3093 | | - return rc; |
|---|
| 3089 | + goto err_ethtool_phy_ops; |
|---|
| 3094 | 3090 | |
|---|
| 3095 | | - ethtool_set_ethtool_phy_ops(&phy_ethtool_phy_ops); |
|---|
| 3096 | 3091 | features_init(); |
|---|
| 3097 | 3092 | |
|---|
| 3098 | 3093 | rc = phy_driver_register(&genphy_c45_driver, THIS_MODULE); |
|---|
| 3099 | 3094 | if (rc) |
|---|
| 3100 | | - goto err_c45; |
|---|
| 3095 | + goto err_mdio_bus; |
|---|
| 3101 | 3096 | |
|---|
| 3102 | 3097 | rc = phy_driver_register(&genphy_driver, THIS_MODULE); |
|---|
| 3103 | | - if (rc) { |
|---|
| 3104 | | - phy_driver_unregister(&genphy_c45_driver); |
|---|
| 3098 | + if (rc) |
|---|
| 3099 | + goto err_c45; |
|---|
| 3100 | + |
|---|
| 3101 | + return 0; |
|---|
| 3102 | + |
|---|
| 3105 | 3103 | err_c45: |
|---|
| 3106 | | - mdio_bus_exit(); |
|---|
| 3107 | | - } |
|---|
| 3104 | + phy_driver_unregister(&genphy_c45_driver); |
|---|
| 3105 | +err_mdio_bus: |
|---|
| 3106 | + mdio_bus_exit(); |
|---|
| 3107 | +err_ethtool_phy_ops: |
|---|
| 3108 | + ethtool_set_ethtool_phy_ops(NULL); |
|---|
| 3108 | 3109 | |
|---|
| 3109 | 3110 | return rc; |
|---|
| 3110 | 3111 | } |
|---|