Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Nisar.Sayed@microchip.com
Cc: davem@davemloft.net, UNGLinuxDriver@microchip.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2 net 1/3] lan78xx: Fix for eeprom read/write when device auto suspend
Date: Mon, 11 Sep 2017 22:24:28 +0200	[thread overview]
Message-ID: <20170911202428.GB5983@lunn.ch> (raw)
In-Reply-To: <CE371C1263339941885964188A0225FA335C84@CHN-SV-EXMX03.mchp-main.com>

On Mon, Sep 11, 2017 at 06:51:49PM +0000, Nisar.Sayed@microchip.com wrote:
> From: Nisar Sayed <Nisar.Sayed@microchip.com>
> 
> Fix for eeprom read/write when device auto suspend
> 
> Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
> Signed-off-by: Nisar Sayed <Nisar.Sayed@microchip.com>
> ---
>  drivers/net/usb/lan78xx.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index b99a7fb..baf91c7 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -1265,30 +1265,44 @@ static int lan78xx_ethtool_get_eeprom(struct net_device *netdev,
>  				      struct ethtool_eeprom *ee, u8 *data)
>  {
>  	struct lan78xx_net *dev = netdev_priv(netdev);
> +	int ret = -EINVAL;
> +
> +	if (usb_autopm_get_interface(dev->intf) < 0)
> +		return ret;

Hi Nisar

It is better to do

   ret = usb_autopm_get_interface(dev->intf;
   if (ret)
        return ret;

i.e. use the error code usb_autopm_get_interface() gives you.

>  	ee->magic = LAN78XX_EEPROM_MAGIC;
>  
> -	return lan78xx_read_raw_eeprom(dev, ee->offset, ee->len, data);
> +	ret = lan78xx_read_raw_eeprom(dev, ee->offset, ee->len, data);
> +
> +	usb_autopm_put_interface(dev->intf);
> +
> +	return ret;
>  }
>  
>  static int lan78xx_ethtool_set_eeprom(struct net_device *netdev,
>  				      struct ethtool_eeprom *ee, u8 *data)
>  {
>  	struct lan78xx_net *dev = netdev_priv(netdev);
> +	int ret = -EINVAL;
> +
> +	if (usb_autopm_get_interface(dev->intf) < 0)
> +		return ret;

Same here.

     Andrew

  reply	other threads:[~2017-09-11 20:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 18:51 [PATCH v2 net 1/3] lan78xx: Fix for eeprom read/write when device auto suspend Nisar.Sayed
2017-09-11 20:24 ` Andrew Lunn [this message]
2017-09-12 13:01   ` Nisar.Sayed

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=20170911202428.GB5983@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Nisar.Sayed@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox