Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3981968pxb; Tue, 25 Jan 2022 00:36:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwikXKMmkngd6rHmYi/GgYILjyP9wDCMOQRlz8B57XBTQV/dRKn3snERZwL4NaGHYMPXu8 X-Received: by 2002:a17:90a:3e4a:: with SMTP id t10mr2437373pjm.70.1643099796070; Tue, 25 Jan 2022 00:36:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099796; cv=none; d=google.com; s=arc-20160816; b=R950Z2EAQ/V9kwSFEXhpzs9hHZys2kpWymyK0ifLLzbqojeEvFy3rYTx6thSaLAnfa WGoRc0XSAchZFuRwMmFe/2gzOTsrjxmn6xVfK7QR1lXeUhp6ejVLErWYhHTgnlJbBsTJ 5fFD/AHqj3MWK7O4QHF3K8nJi/CJDM+RsAbh0lg519zj18UmnssBtGuOKkfX2E22Mhr5 ybu3YElv0cu61Z+HugQQcTMzsaEemg4CHvX8fyDlcj6Kykn1Td3uznSPltMhNz5r0o9y zKLwSMRJ7gWFJ1bZYk3Jlwbjds2oQuRzRuk222boZ4dEoJDR0bESjCUlUth59dI5igvC PmiA== 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=brGI7GrXKSCNAdHDeHzQtdAv8+tupej0rJgDNZvGDx4=; b=SlAEJo8YtbK3BlJQ6hmA50J9y4Nxp8c9BcDz4Kf3IR6cNiVMbfqJQKt8Cjqt+lf3Ap 0HwnXDB0fmdM2OUoaeda8o3OLxyq99RTHyiXT2enxwxmBW1iChf36zKUubezpxIN1oyq sJRWaasl7jp/FUYLZ+vQGnDMqqQ0poHPpbO4akaVTZQQmzNFQ70fY31/LiGjyBJu4fJq cgMQ0zCEByf8iSeYNFve3YwfZvVt+ZcyPuM4HoMKXRqam4TqsjwuxbXhfxaFbrANNKMI JV030ySVxCjvtag6g3+bPcNLPAQprkhWd+NcHr3tkxh1IalMi51mzGqA4sdD99GPNqnb hbZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EqJrYtDm; 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 l9si17794547pfc.282.2022.01.25.00.36.23; Tue, 25 Jan 2022 00:36:36 -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=EqJrYtDm; 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 S1314289AbiAYCum (ORCPT + 99 others); Mon, 24 Jan 2022 21:50:42 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57096 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353146AbiAXVEV (ORCPT ); Mon, 24 Jan 2022 16:04:21 -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 3B9BBB811A9; Mon, 24 Jan 2022 21:04:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 674D4C340E5; Mon, 24 Jan 2022 21:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058257; bh=Px/8V69LgBn1lpcu7IMMdtgNlAppZ3FW1twrHtuTLLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EqJrYtDm5q7UQmvolC+Ts37A8wRAXxKyJ/Ljy+z8zDkN2XZ/73GmAqp4p4752IIm4 tJHv8Ot9Zxa0cNrI+/Ldb4tytoL1IQGuaMWI2+oj5HtgrTKIOyopbJQKkvUMTkdWyU fzKbuz4XS7Z0zjRxcnKXzEBh8Oz7WLLPL+AAevL8= 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.16 0197/1039] media: venus: core: Fix a resource leak in the error handling path of venus_probe() Date: Mon, 24 Jan 2022 19:33:06 +0100 Message-Id: <20220124184131.950143884@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 fd32385485fa6..877eca1258037 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -350,11 +350,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) @@ -386,6 +386,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