From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4802C742A8 for ; Fri, 12 Jul 2019 07:37:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79A50208E4 for ; Fri, 12 Jul 2019 07:37:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gaSFc1Ge" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79A50208E4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=haf5bdnx50A+OS6kYdYWnJrMiWavJdTKXywh2gcydv8=; b=gaSFc1GevSY4pI nK9kcwdf7poLYNCFRiJUtqaW+2hyUkeXxXcEVXIM1beeK1v0V1usgxbjQiseuN2W+Fko17UryjT1g Ee3FqFGJkYqiNvaF+OCpRHH4Cbz8F/xmgSw7kVoNWfufInwAvqOvk+jV96QsZ9YIeSyw5a4IKEZG9 WLwLQlwZGP/Mp6Ai7JDGpYGAfQxUlALEKC1nH8IwF8lXqYB/o2ohk1Qm0AK898/kdv5WBkN6lQvxn FPsLdfTmtKlmptn+iS9yr549VOCQ9iMmBr/AcrfP4mFYz3/Je+djbdeTgCHsSWJriE/Tsli/szcHD gMV9zH4ButlE4kQtYS/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hlq7U-00085v-0e; Fri, 12 Jul 2019 07:37:28 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hlq7Q-00084a-1F; Fri, 12 Jul 2019 07:37:25 +0000 X-UUID: 4abe028e1b5c48ada68dd88742bb93bb-20190711 X-UUID: 4abe028e1b5c48ada68dd88742bb93bb-20190711 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 895729803; Thu, 11 Jul 2019 23:37:17 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 12 Jul 2019 00:37:15 -0700 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 12 Jul 2019 15:37:12 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 12 Jul 2019 15:37:12 +0800 Message-ID: <1562917032.29653.7.camel@mhfsdcap03> Subject: Re: [PATCH] media: platform: mtk-mdp: mtk_mdp_core: Add of_node_put() before goto From: houlong wei To: Nishka Dasgupta Date: Fri, 12 Jul 2019 15:37:12 +0800 In-Reply-To: <20190709172454.13648-1-nishkadg.linux@gmail.com> References: <20190709172454.13648-1-nishkadg.linux@gmail.com> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 79F4A719342E98B201861EFA9EC14351327E4D4119A09EDE5AA191DCE970379F2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190712_003724_075840_23699D5C X-CRM114-Status: GOOD ( 13.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen =?UTF-8?Q?=28=E9=99=B3=E6=99=BA=E8=BF=AA=29?= , Minghsiu Tsai =?UTF-8?Q?=28=E8=94=A1=E6=98=8E=E4=BF=AE=29?= , houlong.wei@mediatek.com, "linux-mediatek@lists.infradead.org" , "matthias.bgg@gmail.com" , "mchehab@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-media@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 2019-07-10 at 01:24 +0800, Nishka Dasgupta wrote: > Each iteration of for_each_child_of_node puts the previous node, but in > the case of a goto from the middle of the loop, there is no put, thus > causing a memory leak. Hence add an of_node_put before the goto in two > places. > Issue found with Coccinelle. > > Signed-off-by: Nishka Dasgupta > --- > drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > index fc9faec85edb..d0a3f06ad83d 100644 > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > @@ -145,13 +145,16 @@ static int mtk_mdp_probe(struct platform_device *pdev) > comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); > if (!comp) { > ret = -ENOMEM; > + of_node_put(node); > goto err_comp; > } > mdp->comp[comp_id] = comp; > > ret = mtk_mdp_comp_init(dev, node, comp, comp_id); > - if (ret) > + if (ret) { > + of_node_put(node); > goto err_comp; > + } > } > > mdp->job_wq = create_singlethread_workqueue(MTK_MDP_MODULE_NAME); Thanks Nishka for fixing the bug. Acked-by: Houlong Wei _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel