Received: by 10.213.65.68 with SMTP id h4csp3397161imn; Tue, 3 Apr 2018 04:20:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/hszsI/Iwu7E1WFv228/RyKILWDLZfYePcyRfwMs6Y+nZi+6kSfjKs4LTq509pbbYnSgeA X-Received: by 10.101.101.136 with SMTP id u8mr1109058pgv.333.1522754426313; Tue, 03 Apr 2018 04:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522754426; cv=none; d=google.com; s=arc-20160816; b=CdlIYppgliv4N6d0dhkxSAex4dtvuObXn+9/Ew6GAsfz7vtxBzdNFphdgm+XIJys5+ LOeTF4q6n2lDnuEu4mhMWtopAk9/3JyjlTl0MXnyuHlq4lqfS3nW8LRnnYhvgWM+1s7I zdjgtv6asj2d3cqWEhYa91CCnqcUT9H6D4V+/PNGtWUJwBWRr7BfOTiT+mF6kB5mtNBR bEkH4+B8ea7SK4J5XMduUK1a69ySeLKAWdWhkn587fXP+XSspSG3ncghxIs+juoLNpQA 2Ggm+/d9FV+ls3aXUy0LAOV6l/g9sdH2XaQra6THWIdjaKTNAQSVbCpGnswKpg2tdr9F ft/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=W/UfIQDwEgbMIXoUWFUS9QFgK3ebyulKhqlM9MVlFSA=; b=aGHuJSV+xrbAARKiovKD1gKblT4zgHYlLure24i+TZem1o5VFJxAN/AwTEp38UmEgx 6bElta4g/WOgmNGvCsBjtwHBGHqLxrugtdsG3YDDjH7ZuDgSedcpsPCEwPyGix40ap8T FCVuHTIAma3bmT38F1zAYYrcujXJG8z9z3pUeiVcCfiQkxgi5pJLExfNptWDqEM3l9cu X4q5cq34hF8JBdQh8GiHOwO95U25Jkn8DsBLYU9hFRVD9wnJhspG0BuzB2ENW5RXpUar oEEiqidZOm5YGA/ipcHKn3ANKqaiFDEhbNyNQDESkGfMWXS0eQbk3OmKxR5kADC/vXtr Oo3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=FSLpVAAD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19-v6si316144plm.736.2018.04.03.04.20.11; Tue, 03 Apr 2018 04:20:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=FSLpVAAD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755458AbeDCLSz (ORCPT + 99 others); Tue, 3 Apr 2018 07:18:55 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:43906 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755121AbeDCLSy (ORCPT ); Tue, 3 Apr 2018 07:18:54 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w33BGsTY011158; Tue, 3 Apr 2018 11:18:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=W/UfIQDwEgbMIXoUWFUS9QFgK3ebyulKhqlM9MVlFSA=; b=FSLpVAADMakwbtMLZg7NLOhej2WQCijpHJ7T8GQo9A3IIn6GRY+ts1phtFQ+ZyL52I5d OZqJe13yIADSTz2+JGXqJVU0TWcCnHLj4eE45nkUNEqpvGBsd9Ms7DRNDQpNLRwD0rWw tgzBAdWx9pkS7hTY3rUTdg7hXtTl5GslSs+CtneMWOn1vyWQwJ4T4Gm5d+j/5wyBqSJb Z/5gS4S0Qp+SE0XaT2lV7b5mHG1k5dPxKL0LMsKwI23wtjf149mLaN/JO+UL9kUw34oF laAjtIxMB5Pfa7HdAuPhy4ue6HvuX8FjppR3bJ6uHb8/FDUv15L/RrGq1Uz/n+Af2sPF iQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2h48kqg05q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Apr 2018 11:18:44 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w33BIhPf026759 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 3 Apr 2018 11:18:44 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w33BIgci015230; Tue, 3 Apr 2018 11:18:42 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Apr 2018 04:18:42 -0700 Date: Tue, 3 Apr 2018 14:18:33 +0300 From: Dan Carpenter To: Ji-Hun Kim Cc: gregkh@linuxfoundation.org, baijiaju1990@gmail.com, forest@alittletooquiet.net, devel@driverdev.osuosl.org, y.k.oh@samsung.com, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, julia.lawall@lip6.fr, santhameena13@gmail.com Subject: Re: [PATCH v4 2/2] staging: vt6655: add handling memory leak on vnt_start() Message-ID: <20180403111833.r6o3xf4go5gfwyj6@mwanda> References: <1522389115-1124-1-git-send-email-ji_hun.kim@samsung.com> <1522389115-1124-2-git-send-email-ji_hun.kim@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522389115-1124-2-git-send-email-ji_hun.kim@samsung.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8851 signatures=668697 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804030118 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 30, 2018 at 02:51:55PM +0900, Ji-Hun Kim wrote: > There was no code for handling memory leaks of device_init_rings() and > request_irq(). It needs to free allocated memory in the device_init_rings() > , when request_irq() is failed. Add freeing sequences of irq and device > init rings. > > Signed-off-by: Ji-Hun Kim > --- > It's additional memory leak handling patch from > [PATCH v4 1/2] staging: vt6655: check for memory allocation failures > > drivers/staging/vt6655/device_main.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c > index c9752df..3604f2d 100644 > --- a/drivers/staging/vt6655/device_main.c > +++ b/drivers/staging/vt6655/device_main.c > @@ -1194,14 +1194,17 @@ static int vnt_start(struct ieee80211_hw *hw) > int ret; > > priv->rx_buf_sz = PKT_BUF_SZ; > - if (!device_init_rings(priv)) > - return -ENOMEM; > + ret = (int)device_init_rings(priv); There is only one call site. Just change device_init_rings() to return negative error codes or zero. > + if (!ret) { > + ret = -ENOMEM; > + goto err_init_rings; Just return directly since there is nothing to clean up. return -ENOMEM; > + } > > ret = request_irq(priv->pcid->irq, vnt_interrupt, > IRQF_SHARED, "vt6655", priv); > if (ret) { > dev_dbg(&priv->pcid->dev, "failed to start irq\n"); > - return ret; > + goto err_irq; This is a "come from" label name. It's better if the goto says what the goto does like "goto err_free_rings;" here. regards, dan carpenter