Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3782045rwi; Fri, 21 Oct 2022 23:32:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Vxje8NaFMHcceo7cjDBjoTaNbfygdFPJ/b3IAur9w7MKqwU3+iODcPUROYtam1UesNlrJ X-Received: by 2002:a05:6402:380a:b0:451:ae08:7a6c with SMTP id es10-20020a056402380a00b00451ae087a6cmr20407053edb.161.1666420365507; Fri, 21 Oct 2022 23:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666420365; cv=none; d=google.com; s=arc-20160816; b=Rre0Z/HORbP9CeNDA/KUuC50a8deI2aBTFkfcsCDt93X7xM3SKrPFYYHdTCgRHQZ9B VgvbxKMgcBKVUbK34jEPk/Oe+ZsgAwOqp0FcM5DWITSTFbCSiLLeIcA1eDHyM8s5vzI8 pNX6P2WmOU8PEVtK10x0CAAuI7dzYIGgdnb8TnrcPCVRLCookXIzs4X680GfwjJ+3XlY iJ9vYoM3xC+TiRllbYs1HgnXriDX1o45VxjnELidLOaD3sRSDyTXTYJeXFSxUa4qhxB6 p/5Ui2x+xsHbC+OJRYWOVMYNpnGJ9AdbWdi7wmUsAbNDKmlhKV37pkW/zuRRv+d2q1nK fyYA== 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 :message-id:date:subject:cc:to:from; bh=4z1E+jmauRuvzq8w5Uvr6s/D8+BiPj+DGndWF/b4xc4=; b=p2rKMIcwGFVgl315bJLiAF1FHhw6oz552/RnDPapR6ts8e17p3TYvi+qGz4H/O1RCU HHcCtY1OuqBr7P810WXeYWY4YTChD6cumu7jVEv1ggcMFszkw3jNRrLWbfyrxTJ0r8sO ZfCs4DvOt1cWNE/t7RE8obo1x3VHO+7uF7ujFB5VTrjg4cMBJs9p+tuK2yW2spoqMhvf AWx3OXEleUm97OqxYLLFMZcgwbhOmsyAwqIqx7NxXEbMtu6gk4EIQJUxteCT1ME3+Bu/ JT5b99vPH0zCbQ7o3V5IXP+FJdc4uy3r3uVDt9/zn2ycVRdpaql0J0WOrE6ubRXiCQZJ nA+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ev16-20020a056402541000b004596d6e78e3si18401169edb.144.2022.10.21.23.32.05; Fri, 21 Oct 2022 23:32:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229497AbiJVGJF (ORCPT + 99 others); Sat, 22 Oct 2022 02:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbiJVGJC (ORCPT ); Sat, 22 Oct 2022 02:09:02 -0400 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F7122B417E for ; Fri, 21 Oct 2022 23:09:01 -0700 (PDT) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id m7gmoMnOL09yum7gnoVAtL; Sat, 22 Oct 2022 08:08:58 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 22 Oct 2022 08:08:58 +0200 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Peng Fan Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-arm-kernel@lists.infradead.org Subject: [PATCH] soc: imx: imx93-pd: Fix the error handling path of imx93_pd_probe() Date: Sat, 22 Oct 2022 08:08:55 +0200 Message-Id: <717cb5dee892bc01257d52b10bb9a1ee79ced87f.1666418916.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In imx93_pd_probe(); if an error occurs, some resources need to be released as done in the remove function. Fixes: 0a0f7cc25d4a ("soc: imx: add i.MX93 SRC power domain driver") Signed-off-by: Christophe JAILLET --- drivers/soc/imx/imx93-pd.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/soc/imx/imx93-pd.c b/drivers/soc/imx/imx93-pd.c index 1f3d7039c1de..4d235c8c4924 100644 --- a/drivers/soc/imx/imx93-pd.c +++ b/drivers/soc/imx/imx93-pd.c @@ -135,11 +135,24 @@ static int imx93_pd_probe(struct platform_device *pdev) ret = pm_genpd_init(&domain->genpd, NULL, domain->init_off); if (ret) - return ret; + goto err_clk_unprepare; platform_set_drvdata(pdev, domain); - return of_genpd_add_provider_simple(np, &domain->genpd); + ret = of_genpd_add_provider_simple(np, &domain->genpd); + if (ret) + goto err_genpd_remove; + + return 0; + +err_genpd_remove: + pm_genpd_remove(&domain->genpd); + +err_clk_unprepare: + if (!domain->init_off) + clk_bulk_disable_unprepare(domain->num_clks, domain->clks); + + return ret; } static const struct of_device_id imx93_pd_ids[] = { -- 2.34.1