summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2017-05-11 10:21:48 +0800
committerPeng Fan <peng.fan@nxp.com>2017-05-11 13:41:38 +0800
commit3f8052264b97b0bf87452876307ca115b7a518a3 (patch)
tree5fa8679723b56f4028ea0f8b194293c3a07cfc2c
parentaad973c1d782f12128eca14214b11b08d2a7f1f7 (diff)
downloadu-boot-imx-3f8052264b97b0bf87452876307ca115b7a518a3.zip
u-boot-imx-3f8052264b97b0bf87452876307ca115b7a518a3.tar.gz
u-boot-imx-3f8052264b97b0bf87452876307ca115b7a518a3.tar.bz2
MLK-14862 net: eth-uclass: add return value check
Add return value check Coverity 392391 Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--net/eth-uclass.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index c3cc315..4c80944 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -3,6 +3,8 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
* Joe Hershberger, National Instruments
*
+ * Copyright 2017 NXP
+ *
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -40,8 +42,12 @@ static int eth_errno;
static struct eth_uclass_priv *eth_get_uclass_priv(void)
{
struct uclass *uc;
+ int ret;
+
+ ret = uclass_get(UCLASS_ETH, &uc);
+ if (ret)
+ return NULL;
- uclass_get(UCLASS_ETH, &uc);
assert(uc);
return uc->priv;
}
@@ -102,6 +108,7 @@ struct udevice *eth_get_dev_by_name(const char *devname)
struct udevice *it;
struct uclass *uc;
int len = strlen("eth");
+ int ret;
/* Must be longer than 3 to be an alias */
if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
@@ -109,7 +116,10 @@ struct udevice *eth_get_dev_by_name(const char *devname)
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) {
/*
* We need the seq to be valid, so try to probe it.