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>
This commit is contained in:
parent
095764e369
commit
ae3ef109c3
@ -1224,6 +1224,9 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
data = calloc(1, sizeof(struct cpsw_platform_data));
|
data = calloc(1, sizeof(struct cpsw_platform_data));
|
||||||
|
if (!data)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
pdata->priv_pdata = data;
|
pdata->priv_pdata = data;
|
||||||
pdata->iobase = dev_read_addr(dev);
|
pdata->iobase = dev_read_addr(dev);
|
||||||
data->version = CPSW_CTRL_VERSION_2;
|
data->version = CPSW_CTRL_VERSION_2;
|
||||||
|
Loading…
Reference in New Issue
Block a user