[PATCH] net: fec_mxc: Set error code on error exit

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 5 13:24:27 CEST 2025


On 04/08/2025 21:36, Fabio Estevam wrote:
> On Mon, Aug 4, 2025 at 12:44 PM Andrew Goodbody
> <andrew.goodbody at linaro.org> wrote:
>>
>> In fecmxc_probe if a timeout is detected when resetting the chip no
>> error code is set before taking the error exit. This could lead to a
>> silent failure. Instead set an error code.
>>
>> This issue was found by Smatch.
>>
>> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
>> ---
>>   drivers/net/fec_mxc.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
>> index 54b08482b91..ccd5589318e 100644
>> --- a/drivers/net/fec_mxc.c
>> +++ b/drivers/net/fec_mxc.c
>> @@ -1344,6 +1344,7 @@ static int fecmxc_probe(struct udevice *dev)
>>          while (readl(&priv->eth->ecntrl) & FEC_ECNTRL_RESET) {
>>                  if (get_timer(start) > (CONFIG_SYS_HZ * 5)) {
>>                          printf("FEC MXC: Timeout resetting chip\n");
>> +                       ret = -ENODEV;
> 
> 'return -ETIMEDOUT;' would be a more appropriate error in the case of a timeout.

Thanks. V2 sent.

Andrew


More information about the U-Boot mailing list