[U-Boot] [PATCH 2/2] net: xilinx emaclite: Fix return values

Michal Simek monstr at monstr.eu
Tue Mar 8 15:25:53 CET 2011


Fix return values for initialize/init/recv/send functions

Signed-off-by: Michal Simek <monstr at monstr.eu>
---
 drivers/net/xilinx_emaclite.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 76af939..3c7c250 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -226,7 +226,7 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len)
 		out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET +
 		XEL_BUFFER_OFFSET, 0);
 #endif
-		return 0;
+		return -1;
 	}
 
 	/* Determine the expected TX buffer address */
@@ -252,7 +252,7 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len)
 			reg |= XEL_TSR_XMIT_ACTIVE_MASK;
 		}
 		out_be32 (baseaddress + XEL_TSR_OFFSET, reg);
-		return 1;
+		return 0;
 	}
 #ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG
 	/* Switch to second buffer */
@@ -273,11 +273,11 @@ static int emaclite_send (struct eth_device *dev, volatile void *ptr, int len)
 			reg |= XEL_TSR_XMIT_ACTIVE_MASK;
 		}
 		out_be32 (baseaddress + XEL_TSR_OFFSET, reg);
-		return 1;
+		return 0;
 	}
 #endif
 	puts ("Error while sending frame\n");
-	return 0;
+	return -1;
 }
 
 static int emaclite_recv(struct eth_device *dev)
@@ -337,7 +337,7 @@ static int emaclite_recv(struct eth_device *dev)
 
 	debug ("Packet receive from 0x%x, length %dB\n", baseaddress, length);
 	NetReceive ((uchar *) etherrxbuff, length);
-	return 1;
+	return length;
 
 }
 
@@ -347,7 +347,7 @@ int xilinx_emaclite_initialize (bd_t *bis, int base_addr)
 
 	dev = malloc(sizeof(*dev));
 	if (dev == NULL)
-		hang();
+		return -1;
 
 	memset(dev, 0, sizeof(*dev));
 	sprintf(dev->name, "Xilinx_Emaclite");
@@ -361,5 +361,5 @@ int xilinx_emaclite_initialize (bd_t *bis, int base_addr)
 
 	eth_register(dev);
 
-	return 0;
+	return 1;
 }
-- 
1.5.5.6



More information about the U-Boot mailing list