From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [v3] tsec: fix the return value for tsec_eth_init()
Date: Sun, 20 Jun 2010 23:07:18 -0700 [thread overview]
Message-ID: <4C1F0196.6030600@gmail.com> (raw)
In-Reply-To: <1276003281-17963-1-git-send-email-timur@freescale.com>
Timur,
On 6/8/2010 6:21 AM, Timur Tabi wrote:
> 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>
> ---
> drivers/net/tsec.c | 15 ++++++++++++---
> 1 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index 3e4c3bd..c62ff82 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)
>
Applied to net/next.
regards,
Ben
prev parent reply other threads:[~2010-06-21 6:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 13:21 [U-Boot] [PATCH] [v3] tsec: fix the return value for tsec_eth_init() Timur Tabi
2010-06-21 6:07 ` Ben Warren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C1F0196.6030600@gmail.com \
--to=biggerbadderben@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox