Skip to contentSkip to conversation

et131x: propagate EEPROM readiness errors

PATCH Applied Avi Weiss 3 participants 3 messages Aug 8 – Aug 11

Subsystems (3)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 et131x: propagate EEPROM readiness errors

eeprom_wait_ready() returns a negative error when the LBCIF status cannot be read or the device does not become ready for some other reason.

eeprom_write() propagates this error before starting a write, but currently returns 0 when the same readiness check fails after the write begins.

This behavior was introduced when the EEPROM code was refactored to use Linux error-return conventions (from 0 = failure to 0 = success).

Return the error so callers do not treat a failed EEPROM write as successful and the function contract is maintained.

Fixes b802ce0c705f ("Staging: et131x: tidy eeprom code up")
---
 drivers/net/ethernet/agere/et131x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/agere/et131x.c +1 -1
index 1b465a167672..4b6a579e9c66 100644
@@ -567,7 +567,7 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data)
 		 */
 		err = eeprom_wait_ready(pdev, &status);
 		if (err < 0)
-			return 0;
+			return err;
 
 		/* Check bit 3 of the LBCIF Status Register.  If  equal to 1,
 		 * an error has occurred.Don't break here if we are revision

base-commit: dd057113ac7ba5bdd2aed3d9405305911152f911

Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Avi Weiss

eeprom_wait_ready() returns a negative error when the LBCIF status cannot be read or the device does not become ready for some other reason.

eeprom_write() propagates this error before starting a write, but currently returns 0 when the same readiness check fails after the write begins.

Quoted 8 lines

This behavior was introduced when the EEPROM code was refactored to use Linux error-return conventions (from 0 = failure to 0 = success).

Return the error so callers do not treat a failed EEPROM write as successful and the function contract is maintained.

Fixes b802ce0c705f ("Staging: et131x: tidy eeprom code up")

Good spot, thanks Avi.

Mark.

Quoted 23 lines

---
 drivers/net/ethernet/agere/et131x.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/agere/et131x.c +1 -1
index 1b465a167672..4b6a579e9c66 100644
@@ -567,7 +567,7 @@ static int eeprom_write(struct et131x_adapter
 *adapter, u32 addr, u8 data)
  		 */
  		err = eeprom_wait_ready(pdev, &status);
  		if (err < 0)
-			return 0;
+			return err;


  /* Check bit 3 of the LBCIF Status Register.  If equal to 1,
  * an error has occurred.Don't break here if we are revision

base-commit: dd057113ac7ba5bdd2aed3d9405305911152f911

#2 lore raw
In reply to Avi Weiss
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Sat, 8 Aug 2026 22:43:47 +0300 you wrote:

eeprom_wait_ready() returns a negative error when the LBCIF status cannot be read or the device does not become ready for some other reason.

eeprom_write() propagates this error before starting a write, but currently returns 0 when the same readiness check fails after the write begins.

[...]

Here is the summary with links:
- [net] et131x: propagate EEPROM readiness errors

    https://git.kernel.org/netdev/net-next/c/341d8aff93e2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html