[U-Boot-Users] [PATCH V2] Fix Ethernet init() return codes.
Ulf Samuelsson
ulf at atmel.com
Wed Jan 9 19:26:08 CET 2008
> On Tue, 08 Jan 2008 17:23:21 -0500
> Ben Warren <biggerbadderben at gmail.com> wrote:
>
>> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
>> index 95cdc49..6657d22 100644
>> --- a/drivers/net/macb.c
>> +++ b/drivers/net/macb.c
>> @@ -423,12 +423,12 @@ static int macb_init(struct eth_device *netdev,
>> bd_t *bd) #endif
>>
>> if (!macb_phy_init(macb))
>> - return 0;
>> + return -1;
>>
>> /* Enable TX and RX */
>> macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE));
>>
>> - return 1;
>> + return 0;
>> }
>>
Why not use symbolic return values?
"return SUCCESS;" seems much more appropriate than
"return 0;" or "return -1;"
if(myfunction() == SUCCESS) {
}
is much more clear than
if(myfunction()) {
}
Best Regards
Ulf Samuelsson
More information about the U-Boot
mailing list