From patchwork Mon Aug 21 20:59:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9913789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 88202603FA for ; Mon, 21 Aug 2017 21:00:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77D6C2869B for ; Mon, 21 Aug 2017 21:00:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B721286C1; Mon, 21 Aug 2017 21:00:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ED6BD2869B for ; Mon, 21 Aug 2017 21:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=orqaWwTxayTrmH9x3pfiro0RCAO3cY4nG3C1oUtqXe0=; b=b2r OS0JcMiccxGkPcMiDdZWRtuVurxQQ93MMQ2ENhkzkuaNbUgm2p1fECiLlyAo5eUh5PjXln5COarG1 KfHlOItCbW7UH0X1caMKLWcJJwQj8a1bDMs8NmEraYjkX5zWRpSSU/wL+r+O4VdthSl4GP9rCsbgB 6ilnE2nvm8FKHUHQidO3KAXWVLArAUGyL7oSsceZd4ekKJNaUHNAT5POTBMjTnms6lV0Gp7MpGdxB 3g54ycmZwrPvghDp6jAccEmVNnCdxKup0+O0kyGzbCSsxiIYTwF09Arc6M9fFtOssTDfW6jjDyqAS DicWZzXL+VzkBPi9jXF5DiR1how5DqA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1djtoY-0002Y4-F5; Mon, 21 Aug 2017 21:00:50 +0000 Received: from smtp04.smtpout.orange.fr ([80.12.242.126] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djtoG-0001Bk-1o for linux-mediatek@lists.infradead.org; Mon, 21 Aug 2017 21:00:34 +0000 Received: from localhost.localdomain ([86.196.182.67]) by mwinf5d39 with ME id zx011v00F1TfVo603x03GV; Mon, 21 Aug 2017 23:00:05 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 21 Aug 2017 23:00:05 +0200 X-ME-IP: 86.196.182.67 From: Christophe JAILLET To: kubakici@wp.pl, kvalo@codeaurora.org, matthias.bgg@gmail.com Subject: [PATCH] mt7601u: check memory allocation failure Date: Mon, 21 Aug 2017 22:59:56 +0200 Message-Id: <20170821205956.20859-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170821_140032_445068_6AD83768 X-CRM114-Status: UNSURE ( 6.23 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Christophe JAILLET , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Check memory allocation failure and return -ENOMEM in such a case, as already done a few lines below Signed-off-by: Christophe JAILLET Acked-by: Jakub Kicinski --- 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]))