Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9127747pxu; Mon, 28 Dec 2020 07:17:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwF89bvoavLRrTz25lEmtVzgKozTJNm+j943uWVQ4APl6x7uWIqA7twYZMIOna19O1qFoBc X-Received: by 2002:a17:906:3a55:: with SMTP id a21mr42503285ejf.516.1609168671401; Mon, 28 Dec 2020 07:17:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168671; cv=none; d=google.com; s=arc-20160816; b=EPqmNfhP3wFpI4rmQzwvAvlwqeqC+1CqVa/Hsu8lTN8oIZ0FzJpWCel1ZGKt2lxxuN J0P81JbAwCBbxcyiCyxSBBHoauBdHJ595FTGwrM5wH7nXelXzNFnMlNo0PTjesgVf/eT kHT51eVdULjGIQ8/XkbfaWY+WxCWP/P1e8dzG0M3vsIKHv1U5L3N0U9wFa+qUfX6Jiyl Qd+RvLEAidDF7r+cBaxsYtbawLP/WNUueHAShdKfuT8cratkycYpsl2UHNzHvLnDJOEt jsqjYrSGZIuU1SS/2YXAa2JiMA8VckLnSTo8R89RpJnBp71BHRsr+f9MGW1bzQZHEEhI RPWg== 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=Q1635TG4msPDFAlnbSGC0JZCJxeaqvIvi9uFFmC8CBY=; b=0TsOkLoafqBZlPDoQyABzxJWSDmPo4Tymc9PT17xN+a9k0SaPPES/4Fma7MA4DrWkt an7rayIam1Id2jLULGp3TlBROTGb6VrzAiubEm72mU8fnBPGQIFp/phLccw/z04XCNUu 4JUG5twCeKbjdscWo7qfR8ENvPvsdu8HlHi/ENSrkwj1eYcOm7pWxFmKiAbrnCb6lsDw YaHugct5QuxIZWekktIb4GCa7c+je+pfBACUUyvkC9fJ/sZKC2ALjKB+NJbURtX453Ea sUqDg5VpHsRo+kzShv1WoT8yqLj0kdK9AOOoAuDFGG0Cmh2PaNKXvWtHA2yi0EoC0q2w sV2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0pTdPB24; 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 s3si20215042edy.134.2020.12.28.07.17.28; Mon, 28 Dec 2020 07:17:51 -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=0pTdPB24; 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 S2437489AbgL1OEv (ORCPT + 99 others); Mon, 28 Dec 2020 09:04:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:38394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437468AbgL1OEq (ORCPT ); Mon, 28 Dec 2020 09:04:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 41A202063A; Mon, 28 Dec 2020 14:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164270; bh=70SNqzPb0kY4difMU7R6ZK1YJCbByF32JvJL1s9LbGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0pTdPB24RQDWElljoqPWf9yn8qe12l2sEpjxDNGdFiUv8KKLcAMqtfFNehb38Zmki bvt65khg43qhC0PCQiHkw05/OMRcWmX+KlEYWheBCXtRDLUtSxZW/K87nmRbuEmbjs /v1ulBxY/AMIJeZucRnMHP+pfLbORSB0nh1Q9bYQ= 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.10 122/717] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_enc_pm() Date: Mon, 28 Dec 2020 13:42:00 +0100 Message-Id: <20201228125026.800913364@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 ee22902aaa71c..1a047c25679fa 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c @@ -47,14 +47,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; @@ -67,11 +69,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++) { @@ -80,17 +85,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