All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, kjlu@umn.edu,
	Michal Simek <michal.simek@xilinx.com>,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] net:phy: Add a return value check on bus write
Date: Wed, 26 Dec 2018 18:44:37 +0100	[thread overview]
Message-ID: <77ffa226-5d4c-3fec-6cdc-a2192eefd5dd@gmail.com> (raw)
In-Reply-To: <20181226173717.7113-1-pakki001@umn.edu>

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@umn.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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Michal Simek <michal.simek@xilinx.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net:phy: Add a return value check on bus write
Date: Wed, 26 Dec 2018 18:44:37 +0100	[thread overview]
Message-ID: <77ffa226-5d4c-3fec-6cdc-a2192eefd5dd@gmail.com> (raw)
In-Reply-To: <20181226173717.7113-1-pakki001@umn.edu>

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@umn.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

  reply	other threads:[~2018-12-26 17:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 17:37 [PATCH] net:phy: Add a return value check on bus write Aditya Pakki
2018-12-26 17:37 ` Aditya Pakki
2018-12-26 17:44 ` Heiner Kallweit [this message]
2018-12-26 17:44   ` Heiner Kallweit
2018-12-26 17:50 ` Heiner Kallweit
2018-12-26 17:50   ` Heiner Kallweit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77ffa226-5d4c-3fec-6cdc-a2192eefd5dd@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kjlu@umn.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=pakki001@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.