mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 06:31:28 +01:00
net: eth-uclass: add return value check
Add return value check Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
a6979f78bc
commit
d2b70205dd
@ -40,8 +40,12 @@ static int eth_errno;
|
|||||||
static struct eth_uclass_priv *eth_get_uclass_priv(void)
|
static struct eth_uclass_priv *eth_get_uclass_priv(void)
|
||||||
{
|
{
|
||||||
struct uclass *uc;
|
struct uclass *uc;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = uclass_get(UCLASS_ETH, &uc);
|
||||||
|
if (ret)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
uclass_get(UCLASS_ETH, &uc);
|
|
||||||
assert(uc);
|
assert(uc);
|
||||||
return uc->priv;
|
return uc->priv;
|
||||||
}
|
}
|
||||||
@ -102,6 +106,7 @@ struct udevice *eth_get_dev_by_name(const char *devname)
|
|||||||
struct udevice *it;
|
struct udevice *it;
|
||||||
struct uclass *uc;
|
struct uclass *uc;
|
||||||
int len = strlen("eth");
|
int len = strlen("eth");
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Must be longer than 3 to be an alias */
|
/* Must be longer than 3 to be an alias */
|
||||||
if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
|
if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
|
||||||
@ -109,7 +114,10 @@ struct udevice *eth_get_dev_by_name(const char *devname)
|
|||||||
seq = simple_strtoul(startp, &endp, 10);
|
seq = simple_strtoul(startp, &endp, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
uclass_get(UCLASS_ETH, &uc);
|
ret = uclass_get(UCLASS_ETH, &uc);
|
||||||
|
if (ret)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
uclass_foreach_dev(it, uc) {
|
uclass_foreach_dev(it, uc) {
|
||||||
/*
|
/*
|
||||||
* We need the seq to be valid, so try to probe it.
|
* We need the seq to be valid, so try to probe it.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user