Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp868932pxb; Thu, 19 Aug 2021 13:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhpLDrOLcu0G+z7RztrhoJUjfBET7jC1aYgZhQcL7EoiQ7n4VZ01sP5iBCAFPbXag0jwlt X-Received: by 2002:a05:6638:265:: with SMTP id x5mr14222414jaq.23.1629404632999; Thu, 19 Aug 2021 13:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629404632; cv=none; d=google.com; s=arc-20160816; b=UXD32+y098Qf3kgIisdkWaLCaCN7Rqw0ncLuJ42xJyu8cE62qUXN2VIckxswpZXfCJ 2deBS83ehm0VgiXgM53Ze+O6siHZbv0qFgTpeko3Mqw1hrjziJrDf6bOOkxrxpdNxUZ1 OT/kR9a/riAfiys8acAkBATCI0k/S5uB2I7d+doyNLSk3dW0s4PAGp153zK9RlXblkgg iW1SG2vN82jsAG4CxL3epV88BoPN3XUzH1fJlSd0VwQjGuCggrFaYjKJlDWtQpzgFVd1 oM/8NeRz+7Kvtk3S0HFJI/3nUsmdVSF+QuHz3gwTEeqlF5Dsp9U9h6cPjsd0B4Krcp3c o+RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=rZaUtVGZTPWz2FjHcEEpjt3TwQknGMIdr2pMEEIf7ZY=; b=r97bLmAy+OKNsjJxYIVkYM79t4yFMhYCu+orxU2XVkQ0D9/8wxJvW04T7kZpZ4CC9j kAGuRazVektBJtlyKZPp/oJ7qLp2B1SWF5iE58b7ooDrNInmgGHY5Zv0tVubYhJ2p+La RfOolf1u8HZgYGaEnQltETqLne6KowvYbDn5XcRzEQX1PQrJFrBF2BHlJ/jSh49qvsZ0 qPztPB3z7/EGAG0KhvCJ7oP1tL2yafF34E4SCIVKEaPdmILlvt2Bq9lFcWAv9CxbVAhM 7sIOzqXomi+de/v/Lc71Vps/IoobUPlHWn+wrNehQ6Ch//qpTXgtYEIUbL5yhFtoyADQ Hg/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si4171495iog.99.2021.08.19.13.23.40; Thu, 19 Aug 2021 13:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233208AbhHSUWH (ORCPT + 99 others); Thu, 19 Aug 2021 16:22:07 -0400 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:18943 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231683AbhHSUWG (ORCPT ); Thu, 19 Aug 2021 16:22:06 -0400 Received: from pop-os.home ([90.126.253.178]) by mwinf5d33 with ME id jYMT250033riaq203YMTFv; Thu, 19 Aug 2021 22:21:28 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 19 Aug 2021 22:21:28 +0200 X-ME-IP: 90.126.253.178 From: Christophe JAILLET To: minghsiu.tsai@mediatek.com, houlong.wei@mediatek.com, andrew-ct.chen@mediatek.com, tiffany.lin@mediatek.com, mchehab@kernel.org, matthias.bgg@gmail.com, hans.verkuil@cisco.com Cc: linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] media: mtk-vpu: Fix a resource leak in the error handling path of 'mtk_vpu_probe()' Date: Thu, 19 Aug 2021 22:21:25 +0200 Message-Id: <3d4ba5d254044567653a006b18971658ec69560f.1629404378.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A successful 'clk_prepare()' call should be balanced by a corresponding 'clk_unprepare()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: 3003a180ef6b ("[media] VPU: mediatek: support Mediatek VPU") Signed-off-by: Christophe JAILLET --- drivers/media/platform/mtk-vpu/mtk_vpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c index ec290dde59cf..7f1647da0ade 100644 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c @@ -848,7 +848,8 @@ static int mtk_vpu_probe(struct platform_device *pdev) vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt"); if (!vpu->wdt.wq) { dev_err(dev, "initialize wdt workqueue failed\n"); - return -ENOMEM; + ret = -ENOMEM; + goto clk_unprepare; } INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func); mutex_init(&vpu->vpu_mutex); @@ -942,6 +943,8 @@ static int mtk_vpu_probe(struct platform_device *pdev) vpu_clock_disable(vpu); workqueue_destroy: destroy_workqueue(vpu->wdt.wq); +clk_unprepare: + clk_unprepare(vpu->clk); return ret; } -- 2.30.2