All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <netdev@vger.kernel.org>,
	Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
	Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
Subject: Re: [PATCH net v2 3/3] igb: fix nvm.ops.read() error handling
Date: Fri, 9 Jun 2023 18:28:57 +0200	[thread overview]
Message-ID: <ZINTSVYbu9byMMFZ@boxer> (raw)
In-Reply-To: <20230609161058.3485225-4-anthony.l.nguyen@intel.com>

On Fri, Jun 09, 2023 at 09:10:58AM -0700, Tony Nguyen wrote:
> From: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

Hey Aleksandr,

> 
> Add error handling into igb_set_eeprom() function, in case
> nvm.ops.read() fails just quit with error code asap.
> 
> Fixes: 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver")
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
> index 7d60da1b7bf4..99b6b21caa02 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
> @@ -822,6 +822,8 @@ static int igb_set_eeprom(struct net_device *netdev,
>  		 */
>  		ret_val = hw->nvm.ops.read(hw, last_word, 1,
>  				   &eeprom_buff[last_word - first_word]);
> +		if (ret_val)
> +			goto out;
>  	}
>  
>  	/* Device's eeprom is always little-endian, word addressable */
> @@ -839,7 +841,7 @@ static int igb_set_eeprom(struct net_device *netdev,
>  	/* Update the checksum if nvm write succeeded */
>  	if (ret_val == 0)
>  		hw->nvm.ops.update(hw);
> -
> +out:
>  	igb_set_fw_version(adapter);

why would you want to call the above in case of fail? just move out below
and stick only to kfree() and return error code.

>  	kfree(eeprom_buff);
>  	return ret_val;
> -- 
> 2.38.1
> 
> 

  reply	other threads:[~2023-06-09 16:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 16:10 [PATCH net v2 0/3][pull request] Intel Wired LAN Driver Updates 2023-06-09 (igc, igb) Tony Nguyen
2023-06-09 16:10 ` [PATCH net v2 1/3] igc: Clean the TX buffer and TX descriptor ring Tony Nguyen
2023-06-09 16:20   ` Maciej Fijalkowski
2023-06-09 16:10 ` [PATCH net v2 2/3] igc: Fix possible system crash when loading module Tony Nguyen
2023-06-09 16:10 ` [PATCH net v2 3/3] igb: fix nvm.ops.read() error handling Tony Nguyen
2023-06-09 16:28   ` Maciej Fijalkowski [this message]
2023-06-12 19:42     ` Loktionov, Aleksandr
2023-06-12 20:31       ` Tony Nguyen

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=ZINTSVYbu9byMMFZ@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=himasekharx.reddy.pucha@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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.