Received: by 10.213.65.68 with SMTP id h4csp1611691imn; Thu, 5 Apr 2018 00:12:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx490RMORgWb1DDQwBsceGL+vBmQ2GAAP3QKXU3BdUr5GAwtYGSkPNHPR/JcXPBPXnB3SO+id X-Received: by 2002:a17:902:bc41:: with SMTP id t1-v6mr21552850plz.56.1522912363526; Thu, 05 Apr 2018 00:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522912363; cv=none; d=google.com; s=arc-20160816; b=wBiNxHNE3QFNA+j7Gr7+f5AVt7NUEAZL16CHvi8/pfJTdq6OhyHwu3ZLD+ba7v9/yN AxsBR745nDIqiEaldVxd3M2tTmQV1uPjcrHEtM8ro+su6Q4ZgqJvx5Me3uJ371Mf1rp1 e8HBajL3uP+uWs4zyQBAYqj0L3WGoJzsHEoBOP1fCkHScx2N7bcD/SOdnBtBSVtbI4ug QCM8nAMRJk26v+VeBw1zrzcBWlT6Tq/ohuigcX2qZpJl+gNdU2pzsXvE7x8Mz1nt9vq2 Cd0DVXn866IO3QscMyZ6LpGNxkt7Sz1NYdkG7w2kdVMnohMYDPtuKbZ3CgwSzGsXwY+X AyxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter:arc-authentication-results; bh=kN5+l9h53UYN9SJL9QuRHI3rQqjjKmx78n3JQDNA/Zo=; b=uhV6nP7y4qKamtk3EdTAY61xD8T9REOWMsVtCnhQvITmt99lJHS6tS0e3eAoBHj63c aB7H4sIOmiqsRIW9SyBe/iuExaAvFHxjdXn+BwONA76gGrrRvufIry0mnXYheILBR2Bc hZpMrA2vAS6FLiZTst+RRnWg2WFJIKdWQv+yU16fFnCfzBd9plEX7VElQOj8VOceEM/h ozSSSRaPAF4eLTkl1PSe9anIIZIsf2eFcpo62S429E28Urje1L0ycMSXpCnGYPSp4L4X 2yS6+PyVY8BFpJIWrUrBaoURDiyJqkEZH8GFmuu6WFk2OkgKEBhFnrGIM8HjTwizKsRy qLtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=stiFn+Qx; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si3710235pfi.67.2018.04.05.00.12.29; Thu, 05 Apr 2018 00:12:43 -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=@samsung.com header.s=mail20170921 header.b=stiFn+Qx; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751425AbeDEHKl (ORCPT + 99 others); Thu, 5 Apr 2018 03:10:41 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:20618 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750853AbeDEHKj (ORCPT ); Thu, 5 Apr 2018 03:10:39 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20180405071037epoutp02d51d3639ebb8243468636f330e72f891~ieJx4j2fa2181821818epoutp02A; Thu, 5 Apr 2018 07:10:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180405071037epoutp02d51d3639ebb8243468636f330e72f891~ieJx4j2fa2181821818epoutp02A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1522912237; bh=kN5+l9h53UYN9SJL9QuRHI3rQqjjKmx78n3JQDNA/Zo=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=stiFn+QxEoA2sz9q6bq/zgoIY7rxgosetOvg/dlFnrjgFdYmQhZHy17vPfANCKHZX LLjv32yQBqQIRRn7GlZPRCNY7Dr8AWk6/zHsniBgrtE3a+J2fBxDrdZ9qa2Svv17UO 8IlhbxhiVnV9lAl45tnEgfoNy6Ko3gFVjUTcXPho= Received: from epsmges2p3.samsung.com (unknown [182.195.40.61]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20180405071037epcas1p319d4e0828ae14491e0e93032a40ada4e~ieJxoBfg11018210182epcas1p3a; Thu, 5 Apr 2018 07:10:37 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id D5.64.04072.DEBC5CA5; Thu, 5 Apr 2018 16:10:37 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20180405071036epcas2p1d676b4a75f9644aac86c5d4a7792ffdf~ieJxS1_RR1214412144epcas2p1O; Thu, 5 Apr 2018 07:10:36 +0000 (GMT) X-AuditID: b6c32a47-0fbff70000000fe8-7a-5ac5cbed79d5 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id AE.78.03827.CEBC5CA5; Thu, 5 Apr 2018 16:10:36 +0900 (KST) Received: from localhost.localdomain ([10.253.107.61]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P6P00DPDAL0WM60@mmp2.samsung.com>; Thu, 05 Apr 2018 16:10:36 +0900 (KST) From: Ji-Hun Kim To: dan.carpenter@oracle.com, gregkh@linuxfoundation.org, baijiaju1990@gmail.com, forest@alittletooquiet.net Cc: dartnorris@gmail.com, santhameena13@gmail.com, julia.lawall@lip6.fr, ji_hun.kim@samsung.com, y.k.oh@samsung.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v5 2/2] staging: vt6655: add handling memory leak on vnt_start() Date: Thu, 05 Apr 2018 16:09:20 +0900 Message-id: <1522912160-21009-2-git-send-email-ji_hun.kim@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1522912160-21009-1-git-send-email-ji_hun.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPKsWRmVeSWpSXmKPExsWy7bCmue7b00ejDOb9Y7ZYN3Ehk8Xrf9NZ LM68P8tksefML3aL+xMesVo0L17PZtF/ejujxbIHpxkttt6Stri8aw6bxclt8hZbun6wOvB4 NDe+Z/W4t+8wi8fOWXfZPfbPXcPusXdLlsfHp7dYPPq2rGL0+LxJLoAjKtUmIzUxJbVIITUv OT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0zB+hWJYWyxJxSoFBAYnGxkr6d TVF+aUmqQkZ+cYmtUrShoZGeoYG5npGRkZ6JeayVkSlQSUJqxssjl5gLbvBUnJh8m62B8TBX FyMnh4SAicTs5ifMXYxcHEICOxglrnR/Z4NwvjNK7L88gRWmalHTLnaIxAZGiXd/v0G1/GCU mDR7MxtIFZuApsTG7muMILaIQJ7EvlWHmUCKmAUuMUosXruSGSQhLBAkcejcBrAiFgFVicaL e8DivAJuEv2/2xkh1slJnDw2GWw1p4C7xL4/G1lBBkkIHGGT2HbuE9RNLhLXJkxghrCFJV4d 38IOYUtLPFu1EWpQtcSCKztYIOwaiZv/lzJB2MYSvT0XwHqZBfgkOg7/BerlAIrzSnS0CUGU eEh0LnkEtcpR4sLGudBwmcUosfnUCcYJjFILGBlWMYqlFhTnpqcWGxUY6xUn5haX5qXrJefn bmIEJyYt9x2M2875H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TaUyHS 05zWE73vReonLm3RGw95VqrHvdr/ZJVSOYfhWSWW4oxEQy3mouJEAHkwqG1EAgAA X-CMS-MailID: 20180405071036epcas2p1d676b4a75f9644aac86c5d4a7792ffdf X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180405071036epcas2p1d676b4a75f9644aac86c5d4a7792ffdf X-RootMTR: 20180405071036epcas2p1d676b4a75f9644aac86c5d4a7792ffdf References: <1522912160-21009-1-git-send-email-ji_hun.kim@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() would be failed. Add freeing sequences of irq and device init rings. Signed-off-by: Ji-Hun Kim --- It's additional memory leak handling patch from the [PATCH v5 1/2] staging: vt6655: check for memory allocation failures Changes v2: - Change label names following coding-style conventions. - Remove uneccessary goto, just return error number like original code. drivers/staging/vt6655/device_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 700c03c..1ab0e85 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1237,13 +1237,13 @@ static int vnt_start(struct ieee80211_hw *hw) IRQF_SHARED, "vt6655", priv); if (ret) { dev_dbg(&priv->pcid->dev, "failed to start irq\n"); - return ret; + goto err_free_rings; } dev_dbg(&priv->pcid->dev, "call device init rd0 ring\n"); ret = device_init_rd0_ring(priv); if (ret) - return ret; + goto err_free_irq; ret = device_init_rd1_ring(priv); if (ret) goto err_free_rd0_ring; @@ -1269,6 +1269,10 @@ static int vnt_start(struct ieee80211_hw *hw) device_free_rd1_ring(priv); err_free_rd0_ring: device_free_rd0_ring(priv); +err_free_irq: + free_irq(priv->pcid->irq, priv); +err_free_rings: + device_free_rings(priv); return ret; } -- 1.9.1