Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3572054pxb; Mon, 24 Jan 2022 12:31:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBGHans/qzlfNc/s9QE/qJhtLg0nxvCs8GPIbm8kgC/Slcs0FDQkZEUB5UKMZjLdvv0IPz X-Received: by 2002:a63:2c1:: with SMTP id 184mr13248298pgc.622.1643056278044; Mon, 24 Jan 2022 12:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056278; cv=none; d=google.com; s=arc-20160816; b=EuABOwWNWHo/yk2xRtPrzHk5gXSyrboOSmr/IaSgpcKl39kKYkdPEojcixv49VJ5mU +vrJij0kiLxpMJf/Kwbur1n+47EXzzlGZ9TtcVBmzn3CUNhRnq0OEAmeAI13pC0UXaWG 2RrUPJmgM9puqnIgMLqoQsGZtU3YF7BdifdH5i8aLpDVDlE8UlfXRC99HXdwRDu2PPu+ xK1ghar2LiFEGGSBwGsEvYQ5UHcKfONxfUF8SZwvY16sKWU3UaPxKhnYnEgkgWBbaD0E +DUyGpoiXftSZp2EVdDo+9g1+Yk/pfeqjqKDNcz2AtjJylbsyw4lS1kgS6nknBA9Xe7W 49XA== 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=YmVaEBs50BAG2+NdK2YCGo8K9L7zozt9rdLJSU9GJGQ=; b=Iqm9fCEajuk5mpBrfGMPCtXzr6+jPSGMf1MeElI56maHL1HlR5T2baIgWLd9X+A2X4 etnpxIZluFS58p5Sa6g1dW/odb52zloB4SWLhKn3kseV3WfGGPdQ2YylsNUSRoQrVpdv lqDoy4D34NlN8C9nawID70YTnjl4AW2s7hr5guC/x9Vg5s8WGy7NtMYw0feiL7csGEtp 9krdpjbDLKRO2CJoiCi1xS5BC51Tx/90qKs0BnIXIGgck0LrN11hi0p2pRVDqzyPjp8S iXzbzDo0nJSishuQoXVZUjITKQWJEz8RftDYx8Jcjmti8sO/xnezVBcMBY7gGipAPKve vErA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2JeXP8Ix; 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 w2si15057581pgm.464.2022.01.24.12.31.05; Mon, 24 Jan 2022 12:31:18 -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=2JeXP8Ix; 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 S1354068AbiAXTfz (ORCPT + 99 others); Mon, 24 Jan 2022 14:35:55 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52128 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348122AbiAXT3a (ORCPT ); Mon, 24 Jan 2022 14:29:30 -0500 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 2A2F3B81232; Mon, 24 Jan 2022 19:29:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59AF6C340E5; Mon, 24 Jan 2022 19:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052566; bh=Kld7CYDt2mevVIhsIFjhJ24FekgJ91SGTvQxVwukp8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2JeXP8IxrU5DVFQ4ej/QHUWKSWqRLTv2CUK37GPlzQJiCmCK3anqrisFo8M+Ulg9i MBP/sDKptYDyZgGjClcyD4r2xYGR8WleBO8Z+xqJP3p3OrzX1N6dXiVdxVD5ptkK4v zTQDuSk9tiWm5X8LtkUKBlxL4qtQuY+6bh7Fy7ao= 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.4 059/320] media: venus: core: Fix a resource leak in the error handling path of venus_probe() Date: Mon, 24 Jan 2022 19:40:43 +0100 Message-Id: <20220124183955.745569890@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 bbc430a003443..7b52d3e5d3f89 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -289,11 +289,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) @@ -329,6 +329,10 @@ err_core_deinit: hfi_core_deinit(core, false); 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