From patchwork Wed Feb 1 10:15:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 650852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 464ADC6FD1A for ; Wed, 1 Feb 2023 10:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbjBAKRF (ORCPT ); Wed, 1 Feb 2023 05:17:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbjBAKQj (ORCPT ); Wed, 1 Feb 2023 05:16:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 227BD53542; Wed, 1 Feb 2023 02:16:38 -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 1A396B81FDA; Wed, 1 Feb 2023 10:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F477C4361C; Wed, 1 Feb 2023 10:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675246593; bh=4DlVblB8F3elgXtYl/ybK6UQCtFfPIALduJwWumbzVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNsGODldlO93I8GvVgFCiD7Z+2kCq1rZ3tqmRwXziFuyep550BZXGHVg+lVKTaCzf HO2c0hp0tHSBwCHl1eCEcew3mjkVJlWmtXLbcWUk7q1jmVvAfTW0E1z7VjOSTIGuuT Ga2XbQhAQ2L8VswsOei8+SuYWAMwCdeaZpTVMsq39MI+mWQy2aVt3oWW74CEUJQBv0 TJKX9kMxvPeL39gogJyYEWdZNC/tWHV6F24wicVuAFaP/845NbUL8XpzGbzAFh6/v1 fRpw5ArSogRCx3n1KKCFyoDJR3o4vorvkivtBJIRqbm0oZ9s7LEXrfWmMwG1gIx5P2 e77bCfdMJ97xg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pNAAg-00044G-7X; Wed, 01 Feb 2023 11:16:54 +0100 From: Johan Hovold To: Georgi Djakov Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andy Gross , Bjorn Andersson , Konrad Dybcio , Sylwester Nawrocki , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 14/23] interconnect: exynos: fix node leak in probe PM QoS error path Date: Wed, 1 Feb 2023 11:15:50 +0100 Message-Id: <20230201101559.15529-15-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201101559.15529-1-johan+linaro@kernel.org> References: <20230201101559.15529-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Make sure to add the newly allocated interconnect node to the provider before adding the PM QoS request so that the node is freed on errors. Fixes: 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs") Cc: stable@vger.kernel.org # 5.11 Cc: Sylwester Nawrocki Signed-off-by: Johan Hovold --- drivers/interconnect/samsung/exynos.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/interconnect/samsung/exynos.c b/drivers/interconnect/samsung/exynos.c index 6559d8cf8068..e70665899482 100644 --- a/drivers/interconnect/samsung/exynos.c +++ b/drivers/interconnect/samsung/exynos.c @@ -149,6 +149,9 @@ static int exynos_generic_icc_probe(struct platform_device *pdev) &priv->bus_clk_ratio)) priv->bus_clk_ratio = EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO; + icc_node->data = priv; + icc_node_add(icc_node, provider); + /* * Register a PM QoS request for the parent (devfreq) device. */ @@ -157,9 +160,6 @@ static int exynos_generic_icc_probe(struct platform_device *pdev) if (ret < 0) goto err_node_del; - icc_node->data = priv; - icc_node_add(icc_node, provider); - icc_parent_node = exynos_icc_get_parent(bus_dev->of_node); if (IS_ERR(icc_parent_node)) { ret = PTR_ERR(icc_parent_node);