This set of patches fixes issues related to logging. First it delete old
code that is no longer used in stmmac_mdio_register(). Then, it fixes a
crash that happens when phydev->drv is NULL and phy_attached_info() is
called prior phy_driver is binded to phydev.
Romain Perier (2):
net: stmmac: Delete dead code for MDIO registration
net: phy: Don't use drv when it is NULL in phy_attached_info
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 16 ----------------
drivers/net/phy/phy_device.c | 13 +++++++++++--
2 files changed, 11 insertions(+), 18 deletions(-)
--
2.11.0
This code is no longer used, the logging function was changed by commit
fbca164776e4 ("net: stmmac: Use the right logging functi").
Fixes: commit fbca164776e4 ("net: stmmac: Use the right logging functi")
Signed-off-by: Romain Perier <redacted>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 16 ----------------
1 file changed, 16 deletions(-)
Currently, if this logging function is used prior the phy driver is
binded to the phy device (that is usually done from .ndo_open),
'phydev->drv' might be NULL, resulting in a kernel crash. That is
typically the case in the stmmac driver, info about the phy is displayed
during the registration of the MDIO bus, and then genphy driver is binded
to this phydev when .ndo_open is called.
This commit fixes the issue by using the right genphy driver, when
phydev->drv is NULL.
Fixes: commit fbca164776e4 ("net: stmmac: Use the right logging functi")
Signed-off-by: Romain Perier <redacted>
---
drivers/net/phy/phy_device.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
From: Sergei Shtylyov <hidden> Date: 2017-08-21 09:45:40
Hello!
On 8/21/2017 10:52 AM, Romain Perier wrote:
Currently, if this logging function is used prior the phy driver is
binded to the phy device (that is usually done from .ndo_open),
s/binded/bound/.
'phydev->drv' might be NULL, resulting in a kernel crash. That is
typically the case in the stmmac driver, info about the phy is displayed
during the registration of the MDIO bus, and then genphy driver is binded
Likewise.
to this phydev when .ndo_open is called.
This commit fixes the issue by using the right genphy driver, when
phydev->drv is NULL.
Fixes: commit fbca164776e4 ("net: stmmac: Use the right logging functi")
Hello,
Le 21/08/2017 à 11:45, Sergei Shtylyov a écrit :
Hello!
On 8/21/2017 10:52 AM, Romain Perier wrote:
quoted
Currently, if this logging function is used prior the phy driver is
binded to the phy device (that is usually done from .ndo_open),
s/binded/bound/.
quoted
'phydev->drv' might be NULL, resulting in a kernel crash. That is
typically the case in the stmmac driver, info about the phy is displayed
during the registration of the MDIO bus, and then genphy driver is
binded
Likewise.
quoted
to this phydev when .ndo_open is called.
This commit fixes the issue by using the right genphy driver, when
phydev->drv is NULL.
Fixes: commit fbca164776e4 ("net: stmmac: Use the right logging functi")
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-08-21 13:16:18
On Mon, Aug 21, 2017 at 09:52:35AM +0200, Romain Perier wrote:
quoted hunk
Currently, if this logging function is used prior the phy driver is
binded to the phy device (that is usually done from .ndo_open),
'phydev->drv' might be NULL, resulting in a kernel crash. That is
typically the case in the stmmac driver, info about the phy is displayed
during the registration of the MDIO bus, and then genphy driver is binded
to this phydev when .ndo_open is called.
This commit fixes the issue by using the right genphy driver, when
phydev->drv is NULL.
Fixes: commit fbca164776e4 ("net: stmmac: Use the right logging functi")
Signed-off-by: Romain Perier <redacted>
---
drivers/net/phy/phy_device.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
Hi Romain
I don't like this. You end up with the same code twice. c45 does not
imply 10g, so i would not be surprised if sometime in the future this
changes. And then we have two places we need to make the same change.
I also wonder what happens if you load the PHY driver later, but
before it is bound. Will it then use the correct driver?