Re: [PATCH] bnxt_en: Fix an error handling path in 'bnxt_get_module_eeprom()'

2017-11-28 Thread Michael Chan
On Tue, Nov 28, 2017 at 7:56 AM, David Miller  wrote:
> From: Christophe JAILLET 
> Date: Tue, 21 Nov 2017 20:46:49 +0100
>
>> Error code returned by 'bnxt_read_sfp_module_eeprom_info()' is handled a
>> few lines above when reading the A0 portion of the EEPROM.
>> The same should be done when reading the A2 portion of the EEPROM.
>>
>> In order to correctly propagate an error, update 'rc' in this 2nd call as
>> well, otherwise 0 (success) is returned.
>>
>> Signed-off-by: Christophe JAILLET 
>
> Patch applied, thanks Chrisophe.
>
> I cannot see any legitimate reason to ignore errors returned here, as
> an error would mean a partial read back of the data to the caller.

Sorry I was on vacation and missed this earlier.  The reason we don't
check for errors in the 2nd part is that the 2nd page may not be
present on some eeproms.

But I think the patch is fine because we return the proper length in
.get_module_info().  So we will now return error only if the user
specifies an invalid length, which is fine.  Thanks.


Re: [PATCH] bnxt_en: Fix an error handling path in 'bnxt_get_module_eeprom()'

2017-11-28 Thread David Miller
From: Christophe JAILLET 
Date: Tue, 21 Nov 2017 20:46:49 +0100

> Error code returned by 'bnxt_read_sfp_module_eeprom_info()' is handled a
> few lines above when reading the A0 portion of the EEPROM.
> The same should be done when reading the A2 portion of the EEPROM.
> 
> In order to correctly propagate an error, update 'rc' in this 2nd call as
> well, otherwise 0 (success) is returned.
> 
> Signed-off-by: Christophe JAILLET 

Patch applied, thanks Chrisophe.

I cannot see any legitimate reason to ignore errors returned here, as
an error would mean a partial read back of the data to the caller.


Re: [PATCH] bnxt_en: Fix an error handling path in 'bnxt_get_module_eeprom()'

2017-11-23 Thread David Miller
From: Christophe JAILLET 
Date: Tue, 21 Nov 2017 20:46:49 +0100

> Error code returned by 'bnxt_read_sfp_module_eeprom_info()' is handled a
> few lines above when reading the A0 portion of the EEPROM.
> The same should be done when reading the A2 portion of the EEPROM.
> 
> In order to correctly propagate an error, update 'rc' in this 2nd call as
> well, otherwise 0 (success) is returned.
> 
> Signed-off-by: Christophe JAILLET 

Michael, please take a look at this.


[PATCH] bnxt_en: Fix an error handling path in 'bnxt_get_module_eeprom()'

2017-11-21 Thread Christophe JAILLET
Error code returned by 'bnxt_read_sfp_module_eeprom_info()' is handled a
few lines above when reading the A0 portion of the EEPROM.
The same should be done when reading the A2 portion of the EEPROM.

In order to correctly propagate an error, update 'rc' in this 2nd call as
well, otherwise 0 (success) is returned.

Signed-off-by: Christophe JAILLET 
---
Un-tested.

If not testing the result of the 2nd call was done on purpose, it should be
documented.
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c 
b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 7ce1d4b7e67d..b13ce5ebde8d 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -2136,8 +2136,8 @@ static int bnxt_get_module_eeprom(struct net_device *dev,
/* Read A2 portion of the EEPROM */
if (length) {
start -= ETH_MODULE_SFF_8436_LEN;
-   bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1, start,
-length, data);
+   rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1,
+ start, length, data);
}
return rc;
 }
-- 
2.14.1