summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2010-06-08 08:21:21 -0500
committerBen Warren <biggerbadderben@gmail.com>2010-07-12 00:14:28 -0700
commitdaa2ce6292c72a6136f1293e23833c587bb89233 (patch)
tree47307a51b1e226d9dc4b780f08a22488424d49c4
parentec0d879f08acf35bc6e935e886ae9a4637ebb713 (diff)
downloadu-boot-imx-daa2ce6292c72a6136f1293e23833c587bb89233.zip
u-boot-imx-daa2ce6292c72a6136f1293e23833c587bb89233.tar.gz
u-boot-imx-daa2ce6292c72a6136f1293e23833c587bb89233.tar.bz2
tsec: fix the return value for tsec_eth_init()
The Ethernet initialization functions are supposed to return the number of devices initialized, so fix tsec_eth_init() so that they returns the number of TSECs initialized, instead of just zero. This is safe because the return value is currently ignored by all callers, but now they don't have to ignore it. In general, if an function initializes only one device, then it should return a negative number if there's an error. If it initializes more than one device, then it should never return a negative number. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
-rw-r--r--drivers/net/tsec.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index bc2707f..54c4a70 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -95,14 +95,23 @@ static struct tsec_info_struct tsec_info[] = {
#endif
};
+/*
+ * Initialize all the TSEC devices
+ *
+ * Returns the number of TSEC devices that were initialized
+ */
int tsec_eth_init(bd_t *bis, struct tsec_info_struct *tsecs, int num)
{
int i;
+ int ret, count = 0;
- for (i = 0; i < num; i++)
- tsec_initialize(bis, &tsecs[i]);
+ for (i = 0; i < num; i++) {
+ ret = tsec_initialize(bis, &tsecs[i]);
+ if (ret > 0)
+ count += ret;
+ }
- return 0;
+ return count;
}
int tsec_standard_init(bd_t *bis)