mirror of
https://xff.cz/git/u-boot/
synced 2025-09-07 19:52:15 +02:00
net: Change return codes from net/eth.c to use errorno constants
Many functions returned -1 previously. Change them to return appropriate error codes. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reported-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Simon Glass
parent
84eb1fba7b
commit
05324a488b
12
net/eth.c
12
net/eth.c
@@ -227,7 +227,7 @@ int eth_unregister(struct eth_device *dev)
|
|||||||
|
|
||||||
/* No device */
|
/* No device */
|
||||||
if (!eth_devices)
|
if (!eth_devices)
|
||||||
return -1;
|
return -ENODEV;
|
||||||
|
|
||||||
for (cur = eth_devices; cur->next != eth_devices && cur->next != dev;
|
for (cur = eth_devices; cur->next != eth_devices && cur->next != dev;
|
||||||
cur = cur->next)
|
cur = cur->next)
|
||||||
@@ -235,7 +235,7 @@ int eth_unregister(struct eth_device *dev)
|
|||||||
|
|
||||||
/* Device not found */
|
/* Device not found */
|
||||||
if (cur->next != dev)
|
if (cur->next != dev)
|
||||||
return -1;
|
return -ENODEV;
|
||||||
|
|
||||||
cur->next = dev->next;
|
cur->next = dev->next;
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ int eth_init(bd_t *bis)
|
|||||||
|
|
||||||
if (!eth_current) {
|
if (!eth_current) {
|
||||||
puts("No ethernet found.\n");
|
puts("No ethernet found.\n");
|
||||||
return -1;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sync environment with network devices */
|
/* Sync environment with network devices */
|
||||||
@@ -397,7 +397,7 @@ int eth_init(bd_t *bis)
|
|||||||
eth_try_another(0);
|
eth_try_another(0);
|
||||||
} while (old_current != eth_current);
|
} while (old_current != eth_current);
|
||||||
|
|
||||||
return -1;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void eth_halt(void)
|
void eth_halt(void)
|
||||||
@@ -413,7 +413,7 @@ void eth_halt(void)
|
|||||||
int eth_send(void *packet, int length)
|
int eth_send(void *packet, int length)
|
||||||
{
|
{
|
||||||
if (!eth_current)
|
if (!eth_current)
|
||||||
return -1;
|
return -ENODEV;
|
||||||
|
|
||||||
return eth_current->send(eth_current, packet, length);
|
return eth_current->send(eth_current, packet, length);
|
||||||
}
|
}
|
||||||
@@ -421,7 +421,7 @@ int eth_send(void *packet, int length)
|
|||||||
int eth_rx(void)
|
int eth_rx(void)
|
||||||
{
|
{
|
||||||
if (!eth_current)
|
if (!eth_current)
|
||||||
return -1;
|
return -ENODEV;
|
||||||
|
|
||||||
return eth_current->recv(eth_current);
|
return eth_current->recv(eth_current);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user