Skip to contentSkip to conversation

net: rtl8169: Fix return value for rtl_send_common

PATCH In review Oleksandr Tymoshenko 4 participants 6 messages Jul 1, 2016 – Jul 12, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: rtl8169: Fix return value for rtl_send_common

Return value of rtl_send_common propogates unmodified all the way up to eth_send and further to API consumer if CONFIG_API is enabled. Previously rtl_send_common returned number of bytes sent on success which was erroneouly detected as error condition by API consumers that checked for operation success by comparing return value with 0.

Switch rtl_send_common to use common convention: return 0 on success and negative value for failure.

Cc Stephen Warren <[email protected]>
Cc Joe Hershberger <[email protected]>
---
 drivers/net/rtl8169.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/rtl8169.c +2 -2
index 843b083..1cc0b40 100644
@@ -666,12 +666,12 @@ static int rtl_send_common(pci_dev_t dev, unsigned long dev_iobase,
 		puts("tx timeout/error\n");
 		printf("%s elapsed time : %lu\n", __func__, currticks()-stime);
 #endif
-		ret = 0;
+		ret = -ETIMEDOUT;
 	} else {
 #ifdef DEBUG_RTL8169_TX
 		puts("tx done\n");
 #endif
-		ret = length;
+		ret = 0;
 	}
 	/* Delay to make net console (nc) work properly */
 	udelay(20);
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 net: rtl8169: Fix return value for rtl_send_common

Quoted 9 lines · Oleksandr Tymoshenko

Return value of rtl_send_common propogates unmodified all the way up to eth_send and further to API consumer if CONFIG_API is enabled. Previously rtl_send_common returned number of bytes sent on success which was erroneouly detected as error condition by API consumers that checked for operation success by comparing return value with 0.

Switch rtl_send_common to use common convention: return 0 on success and negative value for failure.

Quoted 6 lines
Cc Stephen Warren <[email protected]>
Cc Joe Hershberger <[email protected]>
---
 drivers/net/rtl8169.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

But I'd like to see a function comment on rtl_send_common(), and on the driver-model send() method in struct eth_ops, for that matter.

- Simon

#2 lore raw

PATCH 1/1 net: rtl8169: Fix return value for rtl_send_common

Quoted 20 lines · Simon Glass
Quoted 9 lines · Oleksandr Tymoshenko

Return value of rtl_send_common propogates unmodified all the way up to eth_send and further to API consumer if CONFIG_API is enabled. Previously rtl_send_common returned number of bytes sent on success which was erroneouly detected as error condition by API consumers that checked for operation success by comparing return value with 0.

Switch rtl_send_common to use common convention: return 0 on success and negative value for failure.

Quoted 6 lines
Cc Stephen Warren <[email protected]>
Cc Joe Hershberger <[email protected]>

---
drivers/net/rtl8169.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines

But I'd like to see a function comment on rtl_send_common(), and on the driver-model send() method in struct eth_ops, for that matter.

Hi Simon,

Should I submit new version or is it OK to submit new patch with comments added to these two functions?

Thank you

#3 lore raw

PATCH 1/1 net: rtl8169: Fix return value for rtl_send_common

Hi,

Quoted 22 lines · Oleksandr Tymoshenko
Quoted 22 lines · Simon Glass
Quoted 9 lines · Oleksandr Tymoshenko

Return value of rtl_send_common propogates unmodified all the way up to eth_send and further to API consumer if CONFIG_API is enabled. Previously rtl_send_common returned number of bytes sent on success which was erroneouly detected as error condition by API consumers that checked for operation success by comparing return value with 0.

Switch rtl_send_common to use common convention: return 0 on success and negative value for failure.

Quoted 6 lines
Cc Stephen Warren <[email protected]>
Cc Joe Hershberger <[email protected]>

---
drivers/net/rtl8169.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 7 lines
Quoted 2 lines

But I'd like to see a function comment on rtl_send_common(), and on the driver-model send() method in struct eth_ops, for that matter.

Hi Simon,

Should I submit new version or is it OK to submit new patch with comments added to these two functions?

A new patch is fine, thanks.

- Simon

#4 lore raw

PATCH 1/1 net: rtl8169: Fix return value for rtl_send_common

In reply to Oleksandr Tymoshenko
Quoted 6 lines · Oleksandr Tymoshenko

Return value of rtl_send_common propogates unmodified all the way up to eth_send and further to API consumer if CONFIG_API is enabled. Previously rtl_send_common returned number of bytes sent on success which was erroneouly detected as error condition by API consumers that checked for operation success by comparing return value with 0.

Quoted 6 lines

Switch rtl_send_common to use common convention: return 0 on success and negative value for failure.

Cc Stephen Warren <[email protected]>
Cc Joe Hershberger <[email protected]>