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


Groups > linux.kernel > #1716881

[PATCH] mt7601u: check memory allocation failure

From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH] mt7601u: check memory allocation failure
Date 2017-08-21 23:10 +0200
Message-ID <uh27n-12T-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/wireless/mediatek/mt7601u/dma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.c b/drivers/net/wireless/mediatek/mt7601u/dma.c
index 660267b359e4..fa0173579d32 100644
--- a/drivers/net/wireless/mediatek/mt7601u/dma.c
+++ b/drivers/net/wireless/mediatek/mt7601u/dma.c
@@ -484,6 +484,8 @@ static int mt7601u_alloc_tx(struct mt7601u_dev *dev)
 
 	dev->tx_q = devm_kcalloc(dev->dev, __MT_EP_OUT_MAX,
 				 sizeof(*dev->tx_q), GFP_KERNEL);
+	if (!dev->tx_q)
+		return -ENOMEM;
 
 	for (i = 0; i < __MT_EP_OUT_MAX; i++)
 		if (mt7601u_alloc_tx_queue(dev, &dev->tx_q[i]))
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mt7601u: check memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-08-21 23:10 +0200
  Re: [PATCH] mt7601u: check memory allocation failure Jakub Kicinski <kubakici@wp.pl> - 2017-08-21 23:40 +0200
    Re: [PATCH] mt7601u: check memory allocation failure Jakub Kicinski <kubakici@wp.pl> - 2017-08-21 23:50 +0200
      Re: [PATCH] mt7601u: check memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-08-22 00:10 +0200

csiph-web