浏览代码

net: sxgbe: check memory allocation failure

Check memory allocation failure and return -ENOMEM in such a case, as
already done few lines below for another memory allocation.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christophe Jaillet 8 年之前
父节点
当前提交
2207d182c1
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c

+ 2 - 0
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c

@@ -47,6 +47,8 @@ static int sxgbe_probe_config_dt(struct platform_device *pdev,
 	plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
 					   sizeof(*plat->mdio_bus_data),
 					   GFP_KERNEL);
+	if (!plat->mdio_bus_data)
+		return -ENOMEM;
 
 	dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), GFP_KERNEL);
 	if (!dma_cfg)