Netdev List
 help / color / mirror / Atom feed
* [PATCH net] et131x: propagate EEPROM readiness errors
@ 2026-08-08 19:43 Avi Weiss
  2026-08-09 14:35 ` mark.einon
  0 siblings, 1 reply; 2+ messages in thread
From: Avi Weiss @ 2026-08-08 19:43 UTC (permalink / raw)
  To: Mark Einon
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael Grzeschik, Kees Cook, Jacob Keller,
	Uwe Kleine-König (The Capable Hub), Alan Cox,
	Greg Kroah-Hartman, netdev, linux-kernel, 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.

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")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 drivers/net/ethernet/agere/et131x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index 1b465a167672..4b6a579e9c66 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -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.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] et131x: propagate EEPROM readiness errors
  2026-08-08 19:43 [PATCH net] et131x: propagate EEPROM readiness errors Avi Weiss
@ 2026-08-09 14:35 ` mark.einon
  0 siblings, 0 replies; 2+ messages in thread
From: mark.einon @ 2026-08-09 14:35 UTC (permalink / raw)
  To: Avi Weiss
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael Grzeschik, Kees Cook, Jacob Keller,
	Uwe Kleine-König (The Capable Hub), Alan Cox,
	Greg Kroah-Hartman, netdev, linux-kernel

On Sat, 2026-08-08 at 22:43 +0300, Avi Weiss 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.
> 
> 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")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>

Good spot, thanks Avi.

Acked-by: Mark Einon <mark.einon@gmail.com>

Mark.

> ---
>  drivers/net/ethernet/agere/et131x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/agere/et131x.c
> b/drivers/net/ethernet/agere/et131x.c
> index 1b465a167672..4b6a579e9c66 100644
> --- a/drivers/net/ethernet/agere/et131x.c
> +++ b/drivers/net/ethernet/agere/et131x.c
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-09 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 19:43 [PATCH net] et131x: propagate EEPROM readiness errors Avi Weiss
2026-08-09 14:35 ` mark.einon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox