[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77ffa226-5d4c-3fec-6cdc-a2192eefd5dd@gmail.com>
Date: Wed, 26 Dec 2018 18:44:37 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Aditya Pakki <pakki001@....edu>
Cc: kjlu@....edu, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Michal Simek <michal.simek@...inx.com>, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net:phy: Add a return value check on bus write
On 26.12.2018 18:37, Aditya Pakki wrote:
> xgmiitorgmii_read_status() could fail when writing to the bus via
> mdiobus_write(). The fix adds a check and returns an error in case
> of failure.
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
> drivers/net/phy/xilinx_gmii2rgmii.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
> index 74a8782313cf..926879d43373 100644
> --- a/drivers/net/phy/xilinx_gmii2rgmii.c
> +++ b/drivers/net/phy/xilinx_gmii2rgmii.c
> @@ -58,7 +58,9 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
> else
> val |= BMCR_SPEED10;
>
> - mdiobus_write(bus, addr, XILINX_GMII2RGMII_REG, val);
> + err = mdiobus_write(bus, addr, XILINX_GMII2RGMII_REG, val);
> + if (err)
> + return err;
>
> return 0;
Why not simply:
return mdiobus_write(bus, addr, XILINX_GMII2RGMII_REG, val);
Heiner
Powered by blists - more mailing lists