[U-Boot] [PATCH] tsec: fix the return value for tsec_eth_init()
Andy Fleming
afleming at freescale.com
Fri Jun 4 23:39:20 CEST 2010
On Jun 4, 2010, at 4:01 PM, Timur Tabi wrote:
> Andy Fleming wrote:
>
>> The old way continued even if one of the tsecs failed to initialize. Let's preserve the original behavior in that sense:
>>
>> for (i = 0; i < num; i++) {
>> ret = tsec_initialize(bis, &tsecs[i]);
>> if (ret >= 0)
>> count++;
>> }
>
> This code has multiple levels to it. board_eth_init() calls
> tsec_eth_init(), pci_eth_init(), and maybe some other functions.
> tsec_eth_init() calls tsec_initialize(). tsec_initialize() calls
> init_phy(). Are we always going to ignore an error return code? Why don't
> we just eliminate the possibility of returning a negative number at all levels?
>
You just noted that tsec_eth_init should return the number of tsecs initialized successfully. Therefore, the callers can check that number, and respond accordingly. tsec_initialize() can report the error. If we want more elaborate error handling, we can devise something. But with the new scheme, an error in one tsec (like a riser card not being plugged in) will cause all of the tsecs to not be initialized, which seems silly.
Andy
More information about the U-Boot
mailing list