Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9268693pxu; Mon, 28 Dec 2020 10:56:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0F2u38Tx0k0my6XX97qnF2KSDHb/SCqOFzUtJEkFXSbCRwQUuSLG0vSQHGgves9uJ/WXx X-Received: by 2002:aa7:da01:: with SMTP id r1mr44094364eds.45.1609181809030; Mon, 28 Dec 2020 10:56:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609181809; cv=none; d=google.com; s=arc-20160816; b=wBRjoJWJobr84wOmTcy9WQVs9UoUGaOGiDCvCa2ccjYIdcVQGWgDxeG0GI9/3B5tMV dqk4rncoJs6NWiagD7WwMrDv5J6WVj3/Sq9TG0dTOV6X9oFdZfkoXCMx3YneqssjGM+/ 9O8QZhlVmVYV8ejA/OZ4nYm1F0aDlCaIL2mitZD1SNRI3kxpnYRBdnHAVnUmCBbzuGPJ W6px64GrqU6fRW5Iyib2H1p9wZSeeLvLB/3pYBBRHMux4KGpcybtOW9mT7eleRtRePi2 Fd4KjncFqHGkYzVRC1HHPYb4ZFEFYWgAeK0BIBzmuZzFm7vQMYqJMImVErduxsY2QnPt 1g1g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KXpSCrdvIvg2ByXnEtw2rqf3QCyfFYz4dJ0WkE9mjtg=; b=A33JmcbwYXwHzlPmGNK9jRv1LIVGSs81cTkWgnkJvlBC8W2ZZ3LUt5APve4gNF3fv8 MoFQpx8XTNQQi9uGVvSeVRQ6+JQCMBgEph/jf1tDr3/I1H4eOlvbOtU/T58Buj/HQdRD 7g+ZGgOyrTS0FFYoZmyxuLxNt6cmX/lJlWJPBB6zgcDq0KmMvIODP9OJi264p21moT/Y pjGJwE5xIraOqLsfaWB+ii7zVYYLT7ISdnIlseedLZSq5lvzS3UvurfA4PqpTnj7HbKe bClDAYzXlVvmMpw8IqKE05hs6PChU8fjXQcEqzFslmCZ1epHt1X0LDyoArYFed82S/kH eSUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bldWGtcV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 38si20851365edr.163.2020.12.28.10.56.27; Mon, 28 Dec 2020 10:56:49 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bldWGtcV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405445AbgL1Nqx (ORCPT + 99 others); Mon, 28 Dec 2020 08:46:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:47038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404991AbgL1NqC (ORCPT ); Mon, 28 Dec 2020 08:46:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B8B1122583; Mon, 28 Dec 2020 13:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609163121; bh=Vq9XUJqWy4XatoLeG3O5BRx/Xka+t1uuhwviqJbgojU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bldWGtcVkDdvUAPLU3Fqyok6i/prnuzGzVAHoLqmP/Jrw100imuCzL67ZBMzSIZ/1 BK14EsKGkh5+p0HDwDfZKrMn0pRGVAAtqdtgFgtzfSmBhu2Z1P6hm2tNb4FXs1lmuv 9yfn+9X2p5UmnOq+qMoNfct7Db2e68nuOpW+qkwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 135/453] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_enc_pm() Date: Mon, 28 Dec 2020 13:46:11 +0100 Message-Id: <20201228124943.697267668@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu Kuai [ Upstream commit 4affafd7bec7c65da31777f18bd20420f1aeb5f8 ] if of_find_device_by_node() succeed, mtk_vcodec_init_enc_pm() doesn't have a corresponding put_device(). Thus add jump target to fix the exception handling for this function implementation. Fixes: 4e855a6efa54 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver") Signed-off-by: Yu Kuai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c index 3e2bfded79a66..e682bdb1ed453 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c @@ -49,14 +49,16 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) node = of_parse_phandle(dev->of_node, "mediatek,larb", 1); if (!node) { mtk_v4l2_err("no mediatek,larb found"); - return -ENODEV; + ret = -ENODEV; + goto put_larbvenc; } pdev = of_find_device_by_node(node); of_node_put(node); if (!pdev) { mtk_v4l2_err("no mediatek,larb device found"); - return -ENODEV; + ret = -ENODEV; + goto put_larbvenc; } pm->larbvenclt = &pdev->dev; @@ -69,11 +71,14 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) enc_clk->clk_info = devm_kcalloc(&pdev->dev, enc_clk->clk_num, sizeof(*clk_info), GFP_KERNEL); - if (!enc_clk->clk_info) - return -ENOMEM; + if (!enc_clk->clk_info) { + ret = -ENOMEM; + goto put_larbvenclt; + } } else { mtk_v4l2_err("Failed to get venc clock count"); - return -EINVAL; + ret = -EINVAL; + goto put_larbvenclt; } for (i = 0; i < enc_clk->clk_num; i++) { @@ -82,17 +87,24 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) "clock-names", i, &clk_info->clk_name); if (ret) { mtk_v4l2_err("venc failed to get clk name %d", i); - return ret; + goto put_larbvenclt; } clk_info->vcodec_clk = devm_clk_get(&pdev->dev, clk_info->clk_name); if (IS_ERR(clk_info->vcodec_clk)) { mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i, clk_info->clk_name); - return PTR_ERR(clk_info->vcodec_clk); + ret = PTR_ERR(clk_info->vcodec_clk); + goto put_larbvenclt; } } + return 0; + +put_larbvenclt: + put_device(pm->larbvenclt); +put_larbvenc: + put_device(pm->larbvenc); return ret; } -- 2.27.0