summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaiz Abbas <faiz_abbas@ti.com>2019-11-11 15:22:56 +0530
committerTom Rini <trini@konsulko.com>2019-12-03 08:44:14 -0500
commitae3ef109c308652d2143019038a49b43917fdf12 (patch)
tree5abfc43945250a52a7a67f43b245b67e1d5fc38b
parent095764e369ec7e313f6cb45f633b203b4ec622cc (diff)
downloadu-boot-ae3ef109c308652d2143019038a49b43917fdf12.tar.gz
net: cpsw: Add NULL pointer check
Add null pointer check to take care of out of memory errors. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
-rw-r--r--drivers/net/ti/cpsw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index 93d53612b5..57625623c2 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -1224,6 +1224,9 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)
int ret;
data = calloc(1, sizeof(struct cpsw_platform_data));
+ if (!data)
+ return -ENOMEM;
+
pdata->priv_pdata = data;
pdata->iobase = dev_read_addr(dev);
data->version = CPSW_CTRL_VERSION_2;