public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH V2 1/8] net: eth-uclass: add return value check
@ 2020-05-03 14:41 Peng Fan
  2020-05-03 14:41 ` [PATCH V2 2/8] net: Add eth phy generic driver for shared MDIO Peng Fan
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Peng Fan @ 2020-05-03 14:41 UTC (permalink / raw)
  To: u-boot

Add return value check

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 net/eth-uclass.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 8bf2eabe90..950a48d520 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -40,8 +40,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 +106,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 +114,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.
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-05-11 10:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-03 14:41 [PATCH V2 1/8] net: eth-uclass: add return value check Peng Fan
2020-05-03 14:41 ` [PATCH V2 2/8] net: Add eth phy generic driver for shared MDIO Peng Fan
2020-05-11 10:18   ` sbabic at denx.de
2020-05-03 14:41 ` [PATCH V2 3/8] net: Update eQos driver and FEC driver to use eth phy interfaces Peng Fan
2020-05-11 10:17   ` sbabic at denx.de
2020-05-03 14:41 ` [PATCH V2 4/8] net: phy: realtek: add rx delay support for RTL8211F Peng Fan
2020-05-11 10:19   ` sbabic at denx.de
2020-05-03 14:41 ` [PATCH V2 5/8] net: dwc_eth_qos: add dwc eqos for imx support Peng Fan
2020-05-11 10:19   ` sbabic at denx.de
2020-05-03 14:41 ` [PATCH V2 6/8] net: eqos: implement callbaks to get interface and set txclk rate Peng Fan
2020-05-11 10:16   ` sbabic at denx.de
2020-05-03 14:41 ` [PATCH V2 7/8] fec: Move imx_get_mac_from_fuse declare to imx file Peng Fan
2020-05-11 10:17   ` sbabic at denx.de
2020-05-03 14:41 ` [PATCH V2 8/8] eQos: Implement the read_rom_hwaddr callback Peng Fan
2020-05-11 10:15   ` sbabic at denx.de
2020-05-11 10:15 ` [PATCH V2 1/8] net: eth-uclass: add return value check sbabic at denx.de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox