From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Tue, 08 Jun 2010 09:55:43 -0500 Subject: [U-Boot] [PATCH] [v2] tsec: fix the return value for tsec_eth_init() and tsec_standard_init() In-Reply-To: <4C0E56E3.6000007@emk-elektronik.de> References: <1275935487-2031-1-git-send-email-timur@freescale.com> <201006071849.29511.vapier@gentoo.org> <4C0D78D6.2010707@freescale.com> <201006080004.05839.vapier@gentoo.org> <4C0E54F4.8000006@freescale.com> <4C0E56E3.6000007@emk-elektronik.de> Message-ID: <4C0E59EF.5030909@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.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. > >