From patchwork Thu Sep 14 20:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 139966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp741419vqi; Thu, 14 Sep 2023 18:44:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENqbGRag+45Ivp4oAFlv7qqVva8G+IiTgOi5MjCVRJ3S/5E3S9Nq6xeupL4/fdSnu6Rbg5 X-Received: by 2002:a05:620a:2589:b0:767:82e8:eb88 with SMTP id x9-20020a05620a258900b0076782e8eb88mr244821qko.7.1694742277182; Thu, 14 Sep 2023 18:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694742277; cv=none; d=google.com; s=arc-20160816; b=bGeJfaSmEV7TGoZyPDRNQEQTsvDi5BkqWWVrB6GfTizPOtyWK88eUiWZzm06a8eVsF cx8qkO/BQaU1WXAqLZF+FpFnDcKtaOlBqsKaVxKWSUlu0p6nc33xq+9wkS2JeF8dRfbY +v4+XFixCXRPLBG4EUFn0+4PiJY5YDcY5KL//LZwr6B/8Q3q5HTQdfzA82LHkWy/ZwrN U6eQkH7xtHT7Hvx8fTDyuPljNHvlDKsOFAIKVshjCYz5cvJiBVV1pjXR7Bsnc7sl+Rac G4scAd2RYOIKbHdLY4kF1XpzDYWM2DmopdM+BBRPz9mK76aBYGfXap+ENOa2KmQFzM/k XuMA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vDMwGPoL7IUwKLZSj66ABJwQcRH7iJ6OhehhdBpzoGI=; fh=uRtjX4tW/2u6hJ6MjD3hufbLT/8nXPchx+f+WmII/I4=; b=g2xZPsQYYOxLO3v+u8LR58hvc//1cm7i/PsGYK3Bg5+N1y/PBGepfj7D918NLxdSWB 6MAadDlD4dryu/Mx8o824bGiACBtVV9j0105isl46JlKcMv8nMJ8pBGR9vJi5VUFTK20 Uszn4J6MSjLzpOdPAEvPGYKvG9G4tctuOWPDsnnO9CZZ6LjR2JoLoGbjlKwkjzl1q8oc NYrP9xwuh8Z1dHLtlcydaNsH1oaeRHZh3DmjG2CFowuQE6P8INTXYIRH53YIeMD5bHCC tJYrrT63qqFSh+YhqfsNyyPhBioWtx6IVZ0IxWWVdS51YArFNGKId7XxrYH8NC05lJAD F7YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=H53P1VIq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x5-20020a654145000000b00564a1716ebbsi2286644pgp.697.2023.09.14.18.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 18:44:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=H53P1VIq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 28B10819FC48; Thu, 14 Sep 2023 13:31:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229643AbjINUb0 (ORCPT + 33 others); Thu, 14 Sep 2023 16:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229909AbjINUbY (ORCPT ); Thu, 14 Sep 2023 16:31:24 -0400 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19ABF2704 for ; Thu, 14 Sep 2023 13:31:20 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id gszUqMvFz7mcCgszeqSuie; Thu, 14 Sep 2023 22:31:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1694723478; bh=vDMwGPoL7IUwKLZSj66ABJwQcRH7iJ6OhehhdBpzoGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H53P1VIqYoTjl1GsFVQAtp1OUqAcTgfxyzCQIi7cOILeyUZmPhDyWJhgyBfbLcBp1 Ytg/siSE+/4EFWOce4lK2PyDFezrBpi2Y403yLVvLp1XBhT+9W2cr+jitk4DWtiqml Ww737IvD6ByWQupws/gWtCOkh4TqrHIWKsP+0Yp0qBJHd624z/ESKvMjFwkE29XY6i IIEO6CUPSk2FdJXq0YBaIWrD6i2/Z9VlX7nqZo8qrrR6ojDVItnZ7K2DAR//iSheYo MY7ePLJMSK5fxMknV83WAokoDP6yHtaUeQAp58i3pkBi3talLLPHzitWCMYxN3G23u esTHVNSH3ybLw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 14 Sep 2023 22:31:18 +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 v2 1/5] clk: imx: imx8: Fix an error handling path in clk_imx_acm_attach_pm_domains() Date: Thu, 14 Sep 2023 22:31:02 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 13:31:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777066078092616408 X-GMAIL-MSGID: 1777066078092616408 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") Reviewed-by: Peng Fan 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],