From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754358AbdHUWJA (ORCPT ); Mon, 21 Aug 2017 18:09:00 -0400 Received: from smtp04.smtpout.orange.fr ([80.12.242.126]:59115 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753907AbdHUWI6 (ORCPT ); Mon, 21 Aug 2017 18:08:58 -0400 X-ME-Helo: [192.168.1.10] X-ME-Date: Tue, 22 Aug 2017 00:08:57 +0200 X-ME-IP: 86.196.182.67 Subject: Re: [PATCH] mt7601u: check memory allocation failure To: Jakub Kicinski Cc: kvalo@codeaurora.org, matthias.bgg@gmail.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Newsgroups: gmane.linux.kernel,gmane.linux.kernel.wireless.general,gmane.linux.network,gmane.linux.ports.arm.kernel,gmane.linux.ports.arm.mediatek,gmane.linux.kernel.janitors References: <20170821205956.20859-1-christophe.jaillet@wanadoo.fr> <20170821143430.635e4b92@cakuba.netronome.com> <20170821144136.477bf655@cakuba.netronome.com> From: Christophe JAILLET Message-ID: Date: Tue, 22 Aug 2017 00:08:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170821144136.477bf655@cakuba.netronome.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: fr Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 21/08/2017 à 23:41, Jakub Kicinski a écrit : > On Mon, 21 Aug 2017 14:34:30 -0700, Jakub Kicinski wrote: >> On Mon, 21 Aug 2017 22:59:56 +0200, Christophe JAILLET wrote: >>> 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 > Wait, I take that back. This code is a bit weird. We would return an > error, then mt7601u_dma_init() will call mt7601u_free_tx_queue() which > doesn't check for tx_q == NULL condition. > > Looks like mt7601u_free_tx() has to check for dev->tx_q == NULL and > return early if that's the case. Or mt7601u_alloc_tx() should really > clean things up on it's own on failure. Ugh. > You are right. Thanks for the review. I've sent a v2 which updates 'mt7601u_free_tx()'. Doing so sounds more in line with the spirit of this code. CJ