Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4609985pxj; Wed, 12 May 2021 09:11:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbop/SUYc7Jmf6lz5UZq72dqXNl72RFNxezAhlt7jrcmtsoYmz/jPfo/jX3RqzLXb248sX X-Received: by 2002:a4a:ab83:: with SMTP id m3mr14861841oon.2.1620835884294; Wed, 12 May 2021 09:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835884; cv=none; d=google.com; s=arc-20160816; b=0dah/dH98pRMhwcF0AJO6nQrer6Eg3iiLHmBeeX4Ae6FlXOtdUcVdf5Pzbu3mPXUU8 L+o6LwFALU+Wm6sY2UPbm0GE85/ar/IUqRnr3vse+rLszcTgagl8fk0HdsNBN1GHb95p RLIb3Bxjbl8HrwEI58MbHS2fKk7Nv5izO/zcWpkmaUCdDDRB/8N/aSUavxcN3L91yFmC gb3nF6DleM+DOrR45aBw6Rwb8huDJkSxhwVpbCGMtEZyHsF6nxDGw3fvqgJRbCId4V9+ vBJVbYV5b743aIIQ8fPebnajGvqcx7ENSh3UdVEfmJv/aaN7aaiO5oL4krGl0gLVKfuk 2w6g== 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=M5vA1zM/ArEjXUy64TpG74boDfu8VA5wbnNwxr/Dm/k=; b=F2BOPn27FQoF3kJpnTEBZbj6p9MpLEnrkd6WyKJut0cLqmBa8+FJTLYuK1H41LYq9B y67gDaChWqBIQ7P8Jn1Y1pIFFeKiBKtAJuuhD3mfSUknIlO46doo8tD41Y5eW3BUGprG GU5ahsXofcEKZtOO7+kI5Groiup1ufSTJ2J59EFbEu9tgkaqE84/FgOEeAjfLDEtK9qa hcxA2Yv5u8x+j+GnJizpwpBP4p8wrE+BvYFyGwFoAZsbL8iX45EFrPGN7wiOHj10Tbkx Zb+sSCQ1wI3Z+RI5Bz5gIAt3hkUF6gLAym+RbQBSzQvNSuXBed/1765yFOUXwzgO1Tjp 7ftg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GyGHqEbe; 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 x126si347471oig.132.2021.05.12.09.11.10; Wed, 12 May 2021 09:11:24 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GyGHqEbe; 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 S239299AbhELQHu (ORCPT + 99 others); Wed, 12 May 2021 12:07:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:44544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235639AbhELP2n (ORCPT ); Wed, 12 May 2021 11:28:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B967461433; Wed, 12 May 2021 15:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832469; bh=hdvvwhGXMbbIZEFxgF0hIrmr9h0Aa6IQmGSHbni6e50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GyGHqEbeV/ZPvL5cQpj2W5l7ryzlhuhVLh9CQpd7Q/5i2EjgIp1zzWgOJHmXCe0Hw IX0+fUmyL+6RDBD/giBZRD+AfXTZ3GjCLkWY/Z/s0QJ0Ca0AcO9nTMAGHzrFdKSZ+v OdMbJ0qTfzoAqG4tSnyivpVcGdkaqwWBmAvDpwwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 291/530] media: venus: core: Fix some resource leaks in the error path of venus_probe() Date: Wed, 12 May 2021 16:46:41 +0200 Message-Id: <20210512144829.368897257@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Christophe JAILLET [ Upstream commit 5a465c5391a856a0c1e9554964d660676c35d1b2 ] If an error occurs after a successful 'of_icc_get()' call, it must be undone. Use 'devm_of_icc_get()' instead of 'of_icc_get()' to avoid the leak. Update the remove function accordingly and axe the now unneeded 'icc_put()' calls. Fixes: 32f0a6ddc8c9 ("media: venus: Use on-chip interconnect API") Signed-off-by: Christophe JAILLET Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index d5bfd6fff85b..fd5993b3e674 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -195,11 +195,11 @@ static int venus_probe(struct platform_device *pdev) if (IS_ERR(core->base)) return PTR_ERR(core->base); - core->video_path = of_icc_get(dev, "video-mem"); + core->video_path = devm_of_icc_get(dev, "video-mem"); if (IS_ERR(core->video_path)) return PTR_ERR(core->video_path); - core->cpucfg_path = of_icc_get(dev, "cpu-cfg"); + core->cpucfg_path = devm_of_icc_get(dev, "cpu-cfg"); if (IS_ERR(core->cpucfg_path)) return PTR_ERR(core->cpucfg_path); @@ -334,9 +334,6 @@ static int venus_remove(struct platform_device *pdev) hfi_destroy(core); - icc_put(core->video_path); - icc_put(core->cpucfg_path); - v4l2_device_unregister(&core->v4l2_dev); mutex_destroy(&core->pm_lock); mutex_destroy(&core->lock); -- 2.30.2