From patchwork Sun Nov 5 14:52:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13445725 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 C8ECBC4332F for ; Sun, 5 Nov 2023 14:53:16 +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:Cc:Subject:From:To:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=wNpmnXFE52kjnqIJ45cedMmCtIZOQeMRC5X0GVn0m4w=; b=t5v3YVVICVw9aZ 10ndwMdyf6etr5a8i/PFziyY9VcHtvpebD6vQeKVhSYyzbf+c+SjyxA4g6RiQDLlDovcbN6NTpbB6 hoIUjwApy2IJ0BDaxVOr49pTS35+sT4Xa2+oXACm4PUFkV+ggqHNmr66O4Mp8dAln0aM/yLC3Lh25 6WdnLqcxp4KXbVVZ6YGWZ70P/WQeTZs/Kd0c+13r1zvU6vkvUERR1cEt0YjVZzcNiUgbd96v+32Lh I0sv7B+NhrIZO0wLsuplmGu8jpCnSOMtRRu5H+ZdqU7dfc6ISEjbB5rZ+C/3sMKPFG7HiQi3kGQoe jBIFqbfvztumV7LrTd8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qzeUO-00F3z1-0g; Sun, 05 Nov 2023 14:52:36 +0000 Received: from mout.web.de ([212.227.15.3]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qzeUK-00F3yV-1e for linux-arm-kernel@lists.infradead.org; Sun, 05 Nov 2023 14:52:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1699195941; x=1699800741; i=markus.elfring@web.de; bh=cTUM0tlXKDqvxN6TopqTFS5ikFPl23V/+yi1WeDuI1c=; h=X-UI-Sender-Class:Date:To:From:Subject:Cc; b=NCdv0eeqk6RaELUh9BVJgRCGmsZDvR5nPWvQ6H51qz2W+LIZMLIDfVgvXVtNi6Or sA+ZvNcI1jYtWuIRax7tY2lmDiXw82gZoUBj2qNjEvz63baDA4cwt/endhJsOAV1G AlGh6jXlYRFKXuuXe8HgdBzfKBPridF49nwWReFThlmTyIXYhtNjhudfNXK+kZEmU ZLnRdXT8Vm3jNUuZzMByjy3ESe1qS4P9E+9UCs5/VNjx38eyQpBxoWqcxxU53CySg +0/P3zrBMIDnZwS9hvK1Y6jPOw4rXIyiIVqt4Kur2OeOVV5i0uj9L/tuokiyuvaFJ fIX3GECIGhTZWFj7Sw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.80.95]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MnFy4-1rgNDV1kKS-00jbwg; Sun, 05 Nov 2023 15:52:21 +0100 Message-ID: Date: Sun, 5 Nov 2023 15:52:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-GB To: Julia Lawall , Nishanth Menon , Santosh Shilimkar , Tero Kristo , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org From: Markus Elfring Subject: [PATCH] pmdomain: ti: Use common error handling code in ti_sci_pm_domain_probe() Cc: cocci@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mpP7vhN0TxMzGVDsA9MpW6O9s2k+NF1GcKRDm9vgR5 QOSIQ4LERQSPOh9xbWckxUN2ASy+2IOT+YH3HCkWKromDOL/DuHeKt5B8wvC3L0uiFy+t11wT YOhB65y5BLdHMbKIB2dq4rsacAyGMZkKGSlmPLFpHwt0x0AL1tu5vxuFyyuSmbGrf9yHlsmDZ T9xZBA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231105_065233_017434_AEBE31EC X-CRM114-Status: UNSURE ( 8.90 ) X-CRM114-Notice: Please train this message. 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 From: Markus Elfring Date: Sun, 5 Nov 2023 15:30:28 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring --- drivers/pmdomain/ti/ti_sci_pm_domains.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.42.0 diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c index c091d569ecd5..af8a1ed2db70 100644 --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c @@ -153,18 +153,14 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) max_id = args.args[0]; pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); - if (!pd) { - of_node_put(np); - return -ENOMEM; - } + if (!pd) + goto put_node; pd->pd.name = devm_kasprintf(dev, GFP_KERNEL, "pd:%d", args.args[0]); - if (!pd->pd.name) { - of_node_put(np); - return -ENOMEM; - } + if (!pd->pd.name) + goto put_node; pd->pd.power_off = ti_sci_pd_power_off; pd->pd.power_on = ti_sci_pd_power_on; @@ -193,6 +189,10 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) pd_provider->data.domains[pd->idx] = &pd->pd; return of_genpd_add_provider_onecell(dev->of_node, &pd_provider->data); + +put_node: + of_node_put(np); + return -ENOMEM; } static struct platform_driver ti_sci_pm_domains_driver = {