From patchwork Sun Aug 27 09:37:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13366895 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE1A6C83F11 for ; Sun, 27 Aug 2023 09:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tb8HRBKCvtAiD/NH/F7M1Y7byCOfAnbm3ZDb9pq/vqs=; b=RJR2vXpRS9uYzy ZO2ihJSqwhWzREUcoMNrFMl79tQ4SVwK4YCngPD+5uMBsCBjLjvxc4ZHUuGAYfaBGflCVwBkBYKOL WyZNM2o0CGm3bBL0V5pMqDwmwHtwVL2T84QlrQbNApCwelsRM6thshtqLP9cgvEWj1BdtnD6/K0RA cbLy4JePky/TII7o6FzP8Ky/AbaCeWtUlwhW6IUjUN5FFhszrUnzfD+swa0eF3G+h14cuPDv3hCvG hzxevt3UfMd6ax2NEUWBqlfPJlZop4Ke1IqoGPUUMVhK2XG1hFLKOn4r8DKtgRtOYQi8mmTGWj7CN bc9TBD+lMvD43QlR2/Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qaCDs-007kEU-2L; Sun, 27 Aug 2023 09:38:20 +0000 Received: from smtp-16.smtpout.orange.fr ([80.12.242.16] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qaCDq-007kE9-0z for linux-arm-kernel@lists.infradead.org; Sun, 27 Aug 2023 09:38:19 +0000 Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id aCDYqs7H09KIfaCDoq3nY7; Sun, 27 Aug 2023 11:38:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1693129097; bh=piFugZHMLuSIS9b+Rv/FmdqkIddGgweuSK0getmdWiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YJ7XAJ3+B+BiabruVyPjt4PsGR3SEyI6KA0N9ZzKe1O7WTLRY7+zI5tUkCIBTuA5t bZlYskYXbE0zGWWPU3nokcAl/cDDfnn3G3xe1ePsfo/Z1U3EjGHWM24bdc2xO0+Gyp lKyqco2d0LCAV5ijqFVthSYu3TktErkNQj7GhLqHUJFDaR3dcks7n2k9uk032IOZ0p nZMtMcMgJZvQ3N3wg6qAQvg+yrT1pFg6mln7VCkDxfF1+VREHmM8HZErGNYIylbxby TBigHzrjqAsU5YdeolnqtnxbT5BJqICZdrm1SBB9bq2spVbUmfRH+7gA8rGANPYxzc bbT8mV+3w3fEQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 27 Aug 2023 11:38:17 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, shengjiu.wang@nxp.com Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 1/5] clk: imx: imx8: Fix an error handling path in clk_imx_acm_attach_pm_domains() Date: Sun, 27 Aug 2023 11:37:52 +0200 Message-Id: <84ba2f52d43887f954d26a784bd576f20587320f.1693126687.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230827_023818_477802_D9B59D3E X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If a dev_pm_domain_attach_by_id() call fails, previously allocated resources need to be released. Fixes: d3a0946d7ac9 ("clk: imx: imx8: add audio clock mux driver") Signed-off-by: Christophe JAILLET --- drivers/clk/imx/clk-imx8-acm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/imx/clk-imx8-acm.c b/drivers/clk/imx/clk-imx8-acm.c index 1e82f72b75c6..87025a6772d0 100644 --- a/drivers/clk/imx/clk-imx8-acm.c +++ b/drivers/clk/imx/clk-imx8-acm.c @@ -279,8 +279,10 @@ static int clk_imx_acm_attach_pm_domains(struct device *dev, for (i = 0; i < dev_pm->num_domains; i++) { dev_pm->pd_dev[i] = dev_pm_domain_attach_by_id(dev, i); - if (IS_ERR(dev_pm->pd_dev[i])) - return PTR_ERR(dev_pm->pd_dev[i]); + if (IS_ERR(dev_pm->pd_dev[i])) { + ret = PTR_ERR(dev_pm->pd_dev[i]); + goto detach_pm; + } dev_pm->pd_dev_link[i] = device_link_add(dev, dev_pm->pd_dev[i],