[U-Boot] [PATCH] [v2] tsec: fix the return value for tsec_eth_init() and tsec_standard_init()

Reinhard Meyer (-VC) reinhard.meyer at emk-elektronik.de
Tue Jun 8 16:42:43 CEST 2010


Timur Tabi schrieb:
> Mike Frysinger wrote:
>> the documentation currently states that a negative value is permissible and 
>> thus "int" is correct.  as for the code that actually reads the result, that 
>> is by & large common code, so logic along those lines isnt terribly important.
> 
> The conclusion I drew from Andy's comments is that functions which
> initialize more than one device should not return a negative value.  That
> makes sense to me.  Perhaps the documentation should be updated to
> incorporate this idea?

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.
At least in the last case I would assume to return the error code of one
of the devices.
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.
However, in most contexts that might not be helpful to the rest of the
system anyway.



More information about the U-Boot mailing list