All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [v2] tsec: fix the return value for tsec_eth_init() and tsec_standard_init()
Date: Tue, 08 Jun 2010 09:55:43 -0500	[thread overview]
Message-ID: <4C0E59EF.5030909@freescale.com> (raw)
In-Reply-To: <4C0E56E3.6000007@emk-elektronik.de>

Reinhard Meyer (-VC) wrote:

> That poses the general question what a function that initializes several
> devices should do if one of the devices should return an error and what
> to return if ALL devices return an error.

I believe the consensus is that any device initialization function that
returns an error is simply ignored and skipped, which is what my patch does:

	for (i = 0; i < num; i++) {
		ret = tsec_initialize(bis, &tsecs[i]);
		if (ret > 0)
			count += ret;
	}

I could have done "if (ret >= 0)", but that's less efficient.

> At least in the last case I would assume to return the error code of one
> of the devices.

But which error code?  What if the first device returns -1, and the second
one returns -2?

> In the cases where not all, but at least one of the devices get initialized
> without error, the number of successful devices might be returned.

That's what we do today.

> However, in most contexts that might not be helpful to the rest of the
> system anyway.
> 
> 

  reply	other threads:[~2010-06-08 14:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 18:31 [U-Boot] [PATCH] [v2] tsec: fix the return value for tsec_eth_init() and tsec_standard_init() Timur Tabi
2010-06-07 22:49 ` Mike Frysinger
2010-06-07 22:55   ` Timur Tabi
2010-06-08  4:04     ` Mike Frysinger
2010-06-08 14:34       ` Timur Tabi
2010-06-08 14:42         ` Reinhard Meyer
2010-06-08 14:55           ` Timur Tabi [this message]
2010-06-08 19:25         ` Mike Frysinger
2010-06-08  7:14     ` Wolfgang Denk
2010-06-08 13:01       ` Timur Tabi

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=4C0E59EF.5030909@freescale.com \
    --to=timur@freescale.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.