[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SJ0PR11MB5866D9C9759CD6409EECFF00E554A@SJ0PR11MB5866.namprd11.prod.outlook.com>
Date: Mon, 12 Jun 2023 19:42:14 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: "Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>, "Nguyen, Anthony L"
<anthony.l.nguyen@...el.com>
CC: "davem@...emloft.net" <davem@...emloft.net>, "kuba@...nel.org"
<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
"edumazet@...gle.com" <edumazet@...gle.com>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "Pucha, HimasekharX Reddy"
<himasekharx.reddy.pucha@...el.com>
Subject: RE: [PATCH net v2 3/3] igb: fix nvm.ops.read() error handling
> -----Original Message-----
> From: Fijalkowski, Maciej <maciej.fijalkowski@...el.com>
> Sent: Friday, June 9, 2023 6:29 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@...el.com>
> Cc: davem@...emloft.net; kuba@...nel.org; pabeni@...hat.com;
> edumazet@...gle.com; netdev@...r.kernel.org; Loktionov, Aleksandr
> <aleksandr.loktionov@...el.com>; Pucha, HimasekharX Reddy
> <himasekharx.reddy.pucha@...el.com>
> Subject: Re: [PATCH net v2 3/3] igb: fix nvm.ops.read() error handling
>
> On Fri, Jun 09, 2023 at 09:10:58AM -0700, Tony Nguyen wrote:
> > From: Aleksandr Loktionov <aleksandr.loktionov@...el.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@...el.com>
> > Tested-by: Pucha Himasekhar Reddy
> <himasekharx.reddy.pucha@...el.com>
> > (A Contingent worker at Intel)
> > Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.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.
You're right it's better to move out: one line below.
@Nguyen, Anthony L can you make it?
> > kfree(eeprom_buff);
> > return ret_val;
> > --
> > 2.38.1
> >
> >
Powered by blists - more mailing lists