Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3653360pxb; Mon, 24 Jan 2022 14:31:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4BTOam8WPp6rBcG1xNLQ72SI3dococFl1l/N+fNomblg8T+NQzXn2f68HsyJ7V6sm6mJV X-Received: by 2002:a17:902:a70b:b0:14a:f815:a00a with SMTP id w11-20020a170902a70b00b0014af815a00amr16210759plq.168.1643063471432; Mon, 24 Jan 2022 14:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063471; cv=none; d=google.com; s=arc-20160816; b=ortVmz3ah5tORfaMDwz9rmijkx/MS3vXiXtoE3WKCbx6Qb12i1zxYevEVY02pCt8c1 0K5n//7rR95zlXtOuYURqzJltLwQYe27SeEjNJkiapBZDS0FbPeoiYgqRZhgf1DvFWSf R7tGKveDrgN/gggUVe1hRGxarBGddCFnkCHP3uSv93NWYJ2fUI9/Z3s2Y7rkLd1sDzIy oWl0KPdQdGgwSYMywle/epRIHeqUgnKGgGdiK0QHDvHbMH9iBPvpjhuKwSV9SQWIQhVJ b0L3JTxNfADIGj7C0kUSgq8bZCkUxdodWos8ivK8r82ghknqsAUIKzSG9iWLplQzfl72 jIAQ== 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=9lKDy17UgOl6Wn3Llj8RlxOryvNKoKvMe7PdH/p3x/o=; b=fE13EH1tjuhVjyFpAO5SSDfxc+VITyOhF1pH7ECvIBCIRvRFtApMRcy/8A6qGX9Ve5 e2Cgx9crwUMqbO0EbBthWo2eB9USbB0Mt7IRbrE49dav3cXpVU0Mo9JJXY1gfIAH8fTc /JiOyAIbf+TCsCAgKujOB8+DXpwb6V7wC0pbUKCJSKeYy9ZlUuF5Q84eg4ZMuRyLkPa/ 70zgPfTB6mOYr7HrlQgYSREc3gBzso/CZururoMywZEI8n5fYJLqtxGw9k4AlTd7J4hW J6K6QbHK4HebnizhX4yfeOKTCW38TrjJL3y1p/4URkwZkMFWl2guTYYbH1bMmU2X/MbJ LmXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JJZ6y0WL; 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 v19si18031702pfu.36.2022.01.24.14.30.59; Mon, 24 Jan 2022 14:31:11 -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=JJZ6y0WL; 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 S1586366AbiAXW0T (ORCPT + 99 others); Mon, 24 Jan 2022 17:26:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443767AbiAXV1G (ORCPT ); Mon, 24 Jan 2022 16:27:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEBACC073210; Mon, 24 Jan 2022 12:18:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ABB2CB8122D; Mon, 24 Jan 2022 20:18:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17C63C340E5; Mon, 24 Jan 2022 20:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055499; bh=ayuHdt44yiGjS+h8udiibZejaqg80hjNXckpKzmMaOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJZ6y0WLY52s0qiGwxGqnw8MXRzZP0OCuBFbFumf5iyMDgQONV3SjCOkaEBFqWwlk KvCOkthb/DVptEsyIGsQWRTlK753wXXIbpCuexzETRCDOg5JzEBqx/css5vwISQP5r i+zQSl/fwwdauCw0IVyIfUUcN7HeWM/5+LQZ4jhY= 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.15 171/846] media: venus: core: Fix a resource leak in the error handling path of venus_probe() Date: Mon, 24 Jan 2022 19:34:48 +0100 Message-Id: <20220124184106.877285650@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 8cc7a1b2aca067397a016cdb971a5e6ad9b640c7 ] A successful 'of_platform_populate()' call should be balanced by a corresponding 'of_platform_depopulate()' call in the error handling path of the probe, as already done in the remove function. A successful 'venus_firmware_init()' call should be balanced by a corresponding 'venus_firmware_deinit()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: f9799fcce4bb ("media: venus: firmware: register separate platform_device for firmware loader") 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 84cd92628cfdc..1f0181b6353c9 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -349,11 +349,11 @@ static int venus_probe(struct platform_device *pdev) ret = venus_firmware_init(core); if (ret) - goto err_runtime_disable; + goto err_of_depopulate; ret = venus_boot(core); if (ret) - goto err_runtime_disable; + goto err_firmware_deinit; ret = hfi_core_resume(core, true); if (ret) @@ -385,6 +385,10 @@ err_dev_unregister: v4l2_device_unregister(&core->v4l2_dev); err_venus_shutdown: venus_shutdown(core); +err_firmware_deinit: + venus_firmware_deinit(core); +err_of_depopulate: + of_platform_depopulate(dev); err_runtime_disable: pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); -- 2.34.1