lkml.org 
[lkml]   [2023]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH net v2 2/2] smsc911x: avoid PHY being resumed when interface is not up
    From
    Date
    On Mon, 2023-03-20 at 10:20 +0100, Wolfram Sang wrote:
    > SMSC911x doesn't need mdiobus suspend/resume, that's why it sets
    > 'mac_managed_pm'. However, setting it needs to be moved from init to
    > probe, so mdiobus PM functions will really never be called (e.g. when
    > the interface is not up yet during suspend/resume). The errno is changed
    > because ENODEV has a special meaning when returned in probe().
    >
    > Fixes: 3ce9f2bef755 ("net: smsc911x: Stop and start PHY during suspend and resume")
    > Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
    > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    > ---
    > Changes since v1:
    > * no change
    >
    > In smsc911x_mii_probe(), I remove the sanity check for 'phydev' because
    > it was already done in smsc911x_mii_init(). Let me know if this is
    > acceptable or if a more defensive approach is favoured.

    Since this is a fix, I would keep the old check, too.

    > @@ -1108,6 +1102,15 @@ static int smsc911x_mii_init(struct platform_device *pdev,
    > goto err_out_free_bus_2;
    > }
    >
    > + phydev = phy_find_first(pdata->mii_bus);
    > + if (!phydev) {
    > + netdev_err(dev, "no PHY found\n");
    > + err = -ENOENT;
    > + goto err_out_free_bus_2;

    Why don't you call mdiobus_unregister() in this error path?

    mdiobus_register() completed successfully a few lines above.

    Cheers,

    Paolo

    \
     
     \ /
      Last update: 2023-03-27 01:11    [W:3.360 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site