]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: sxgbe: check memory allocation failure
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Fri, 25 Aug 2017 05:35:51 +0000 (07:35 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Aug 2017 03:07:07 +0000 (20:07 -0700)
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>
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c

index 73427e29df2afb808a0b525ebb1978df4d76a996..fbd00cb0cb7d7204e97b9b11d8ae058c95148834 100644 (file)
@@ -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)