diff mbox series

[net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails

Message ID 026aa4f2-36f5-1c10-ab9f-cdb17dda6ac4@gmail.com (mailing list archive)
State Accepted
Commit c22c3bbf351e4ce905f082649cffa1ff893ea8c1
Delegated to: Netdev Maintainers
Headers show
Series [net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Heiner Kallweit March 11, 2023, 6:34 p.m. UTC
If genphy_read_status fails then further access to the PHY may result
in unpredictable behavior. To prevent this bail out immediately if
genphy_read_status fails.

Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/smsc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Simon Horman March 13, 2023, 1:36 p.m. UTC | #1
On Sat, Mar 11, 2023 at 07:34:45PM +0100, Heiner Kallweit wrote:
> If genphy_read_status fails then further access to the PHY may result
> in unpredictable behavior. To prevent this bail out immediately if
> genphy_read_status fails.
> 
> Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

> ---
>  drivers/net/phy/smsc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
> index 9cfaccce1..721871184 100644
> --- a/drivers/net/phy/smsc.c
> +++ b/drivers/net/phy/smsc.c
> @@ -189,8 +189,11 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)
>  static int lan87xx_read_status(struct phy_device *phydev)
>  {
>  	struct smsc_phy_priv *priv = phydev->priv;
> +	int err;
>  
> -	int err = genphy_read_status(phydev);
> +	err = genphy_read_status(phydev);
> +	if (err)
> +		return err;
>  
>  	if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
>  		/* Disable EDPD to wake up PHY */
> -- 
> 2.39.2
patchwork-bot+netdevbpf@kernel.org March 15, 2023, 7:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 11 Mar 2023 19:34:45 +0100 you wrote:
> If genphy_read_status fails then further access to the PHY may result
> in unpredictable behavior. To prevent this bail out immediately if
> genphy_read_status fails.
> 
> Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
    https://git.kernel.org/netdev/net/c/c22c3bbf351e

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 9cfaccce1..721871184 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -189,8 +189,11 @@  static int lan95xx_config_aneg_ext(struct phy_device *phydev)
 static int lan87xx_read_status(struct phy_device *phydev)
 {
 	struct smsc_phy_priv *priv = phydev->priv;
+	int err;
 
-	int err = genphy_read_status(phydev);
+	err = genphy_read_status(phydev);
+	if (err)
+		return err;
 
 	if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
 		/* Disable EDPD to wake up PHY */