[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20160501.205031.116469285201732756.davem@davemloft.net>
Date: Sun, 01 May 2016 20:50:31 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: marex@...x.de
Cc: netdev@...r.kernel.org, arnd@...db.de,
dinguyen@...nsource.altera.com, f.fainelli@...il.com,
sergei.shtylyov@...entembedded.com
Subject: Re: [PATCH V2] mdio_bus: Fix MDIO bus scanning in
__mdiobus_register()
From: Marek Vasut <marex@...x.de>
Date: Mon, 2 May 2016 02:47:31 +0200
> Since commit b74766a0a0fe ("phylib: don't return NULL
> from get_phy_device()") in linux-next, phy_get_device() will return
> ERR_PTR(-ENODEV) instead of NULL if the PHY device ID is all ones.
>
> This causes problem with stmmac driver and likely some other drivers
> which call mdiobus_register(). I triggered this bug on SoCFPGA MCVEVK
> board with linux-next 20160427 and 20160428. In case of the stmmac, if
> there is no PHY node specified in the DT for the stmmac block, the stmmac
> driver ( drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c function
> stmmac_mdio_register() ) will call mdiobus_register() , which will
> register the MDIO bus and probe for the PHY.
>
> The mdiobus_register() resp. __mdiobus_register() iterates over all of
> the addresses on the MDIO bus and calls mdiobus_scan() for each of them,
> which invokes get_phy_device(). Before the aforementioned patch, the
> mdiobus_scan() would return NULL if no PHY was found on a given address
> and mdiobus_register() would continue and try the next PHY address. Now,
> mdiobus_scan() returns ERR_PTR(-ENODEV), which is caught by the
> 'if (IS_ERR(phydev))' condition and the loop exits immediately if the
> PHY address does not contain PHY.
>
> Repair this by explicitly checking for the ERR_PTR(-ENODEV) and if this
> error comes around, continue with the next PHY address.
>
> Signed-off-by: Marek Vasut <marex@...x.de>
> Acked-by: Florian Fainelli <f.fainelli@...il.com>
Applied, thanks.
Powered by blists - more mailing lists