Skip to contentSkip to conversation

smc911111: fix send and recv return value

PATCH Applied Jean-Christophe PLAGNIOL-VILLARD 2 participants 2 messages Feb 24, 2013 – Feb 25, 2013 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smc911111: fix send and recv return value

on error send error code and 0 on success

---
 drivers/net/smc91111.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/smc91111.c +6 -6
index 695fa7d..48183dd 100644
@@ -935,7 +935,7 @@ static int smc91c111_eth_send(struct eth_device *edev, void *packet,
 
 	if (numPages > 7) {
 		printf ("%s: Far too big packet error. \n", SMC_DEV_NAME);
-		return 0;
+		return -EOVERFLOW;
 	}
 
 	/* now, try to allocate the memory */
@@ -965,7 +965,7 @@ again:
 		if (try < SMC_ALLOC_MAX_TRY)
 			goto again;
 		else
-			return 0;
+			return -ETIMEDOUT;
 	}
 
 	PRINTK2 ("%s: memory allocation, try %d succeeded ...\n",
@@ -980,7 +980,7 @@ again:
 	if (packet_no & AR_FAILED) {
 		/* or isn't there?  BAD CHIP! */
 		printf ("%s: Memory allocation failed. \n", SMC_DEV_NAME);
-		return 0;
+		return -ENOMEM;
 	}
 
 	/* we have a packet address, so tell the card to use it */
@@ -1046,7 +1046,7 @@ again:
 	SMC_outb(priv, saved_pnr, PN_REG );
 	SMC_outw(priv, saved_ptr, PTR_REG );
 
-	return length;
+	return 0;
 }
 
 static void smc91c111_eth_halt(struct eth_device *edev)
@@ -1152,10 +1152,10 @@ static int smc91c111_eth_rx(struct eth_device *edev)
 	if (!is_error) {
 		/* Pass the packet up to the protocol layers. */
 		net_receive(NetRxPackets[0], packet_length);
-		return packet_length;
+		return 0;
 	}
 
-	return 0;
+	return -EINVAL;
 }
 
 static int smc91c111_get_ethaddr(struct eth_device *edev, unsigned char *m)
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD

on error send error code and 0 on success

Applied, thanks

Sascha

Quoted 66 lines
---
 drivers/net/smc91111.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/smc91111.c +6 -6
index 695fa7d..48183dd 100644
@@ -935,7 +935,7 @@ static int smc91c111_eth_send(struct eth_device *edev, void *packet,
 
 	if (numPages > 7) {
 		printf ("%s: Far too big packet error. \n", SMC_DEV_NAME);
-		return 0;
+		return -EOVERFLOW;
 	}
 
 	/* now, try to allocate the memory */
@@ -965,7 +965,7 @@ again:
 		if (try < SMC_ALLOC_MAX_TRY)
 			goto again;
 		else
-			return 0;
+			return -ETIMEDOUT;
 	}
 
 	PRINTK2 ("%s: memory allocation, try %d succeeded ...\n",
@@ -980,7 +980,7 @@ again:
 	if (packet_no & AR_FAILED) {
 		/* or isn't there?  BAD CHIP! */
 		printf ("%s: Memory allocation failed. \n", SMC_DEV_NAME);
-		return 0;
+		return -ENOMEM;
 	}
 
 	/* we have a packet address, so tell the card to use it */
@@ -1046,7 +1046,7 @@ again:
 	SMC_outb(priv, saved_pnr, PN_REG );
 	SMC_outw(priv, saved_ptr, PTR_REG );
 
-	return length;
+	return 0;
 }
 
 static void smc91c111_eth_halt(struct eth_device *edev)
@@ -1152,10 +1152,10 @@ static int smc91c111_eth_rx(struct eth_device *edev)
 	if (!is_error) {
 		/* Pass the packet up to the protocol layers. */
 		net_receive(NetRxPackets[0], packet_length);
-		return packet_length;
+		return 0;
 	}
 
-	return 0;
+	return -EINVAL;
 }
 
 static int smc91c111_get_ethaddr(struct eth_device *edev, unsigned char *m)
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox