Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719761 > unrolled thread

[PATCH] net: sxgbe: check memory allocation failure

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-08-25 07:50 +0200
Last post2017-08-26 05:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: sxgbe: check memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-08-25 07:50 +0200
    Re: [PATCH] net: sxgbe: check memory allocation failure David Miller <davem@davemloft.net> - 2017-08-26 05:10 +0200

#1719761 — [PATCH] net: sxgbe: check memory allocation failure

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-08-25 07:50 +0200
Subject[PATCH] net: sxgbe: check memory allocation failure
Message-ID<uifFf-8sr-1@gated-at.bofh.it>
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>
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index 73427e29df2a..fbd00cb0cb7d 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/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)
-- 
2.11.0

[toc] | [next] | [standalone]


#1720529

FromDavid Miller <davem@davemloft.net>
Date2017-08-26 05:10 +0200
Message-ID<uizDY-4hi-15@gated-at.bofh.it>
In reply to#1719761
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Fri, 25 Aug 2017 07:35:51 +0200

> 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>

Applied, thank you.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web