sungem: fix PHY initialization hardware failure check and pointe style
Subsystems (2)
PATCH 1/1 sungem: fix PHY initialization hardware failure check and pointe style
Currently, bcm5411_init does not validate the result of the PHY register reads. This can lead to silent failures if the hardware is unresponsive or the MDIO bus times out, as 0xffff would be treated as valid data.
This patch:
1: Adds a check for -EIO and 0xffff during BCM5411 initialization. 2: Updates gem_init_phy to log an error message fi the PHY-
specific init fails.
3: Cleans up pointer formatting(eg,. foo* bar to foo *bar) to
align with Linux Kernel Coding Style in the modified files.
--- drivers/net/ethernet/sun/sungem.c | 8 +++-- drivers/net/sungem_phy.c | 60 +++++++++++++++++-------------- 2 files changed, 39 insertions(+), 29 deletions(-)
drivers/net/ethernet/sun/sungem.c +6 -2
@@ -1707,8 +1707,12 @@ static void gem_init_phy(struct gem *gp)sungem_phy_probe (&gp->phy_mii, gp->mii_phy_addr);/* Init PHY */ -if (gp->phy_mii.def && gp->phy_mii.def->ops->init) - gp->phy_mii.def->ops->init (&gp->phy_mii); +if (gp->phy_mii.def && gp->phy_mii.def->ops->init) { +int err = gp->phy_mii.def->ops->init (&gp->phy_mii); + +if (err) +netdev_err (gp->dev,"PHY init failed: %d\n" , err); + } }else {gem_pcs_reset (gp);gem_pcs_reinit_adv (gp);
drivers/net/sungem_phy.c +33 -27
215 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 10 lines · Joel
Currently,
bcm5411_initdoes not validate the result of the PHY register reads. This can lead to silent failures if the hardware is unresponsive or the MDIO bus times out, as0xffffwould be treated as valid data.This patch:
1: Adds a check for-EIOand0xffffduring BCM5411 initialization. 2: Updatesgem_init_phyto log an error message fi the PHY-
specific init fails.
3: Cleans up pointer formatting(eg,. foo* bar to foo *bar) to
align with Linux Kernel Coding Style in the modified files.
A patch which does three things should probably be three patches. We want lots of small patches, with good commit messages, which are obviously correct.
Code style changes should definitely be in a different patch to real changes.
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Andrew
---
pw-bot: cr