From patchwork Fri Dec 22 12:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13503275 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 416E4C41535 for ; Fri, 22 Dec 2023 12:04:07 +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:Subject:From:Cc: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=v/2bfaiAAVGH6qvfEgsq6llr4ZKuurtaq6rTRQ73X30=; b=uZndPnXfxEpVId xxEB/7dZmw2C+lIJ/OvdmYYhuvsilHK28BCxFOwpFuZm4PWLuq+u4h62il+1Me5d96YDYlZPafq8c 8Ud5b9G/8wlSJI3jeMvUm8VE4X7qLjjJ2nJinTWSLeLjtaMxxeRjASfqhnNfQRO3GiibGJxV8o8oX qKSVMlVY35QzsW65x4qcCmeTLtzXa/KLNMrDlCUIB2vmye58RUsdt4Hr9NBLxaUsRSU9O3tn4E/k4 ee78nCmTh9LttByCVs3fmau8yuwxh+d6v+uYRlulKQKEA66EZKvy9npLca/4Xv0hF6/b/Mc44WOLO zXO/6vtYU/JToPAK9utw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGeFe-005tW2-1B; Fri, 22 Dec 2023 12:03:38 +0000 Received: from mout.web.de ([212.227.17.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGeFb-005tUZ-0K for linux-arm-kernel@lists.infradead.org; Fri, 22 Dec 2023 12:03:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703246590; x=1703851390; i=markus.elfring@web.de; bh=+/jv+l30EGrAi9nYpLc4XLLYanHvltsf8lsVWJ+WBq8=; h=X-UI-Sender-Class:Date:To:Cc:From:Subject; b=G2BJGfNcZ5Dwi+GePNcsGfk9kf3cmYpUjdmzlUiup2V04tmzmrdaJE+HKtaTFDmy C9iQp9rfhg2NQYHKZNgQPYZKwe2sjR/XOQ9ff5sUMWBk4s8JtFtxWTOhJ2cqublPK Wzq5t9CQvJ7v6pb7gHoEv98ynTWEIBkX2FKA0XaFms5dxCldwO6SOcKV/rqtqJIoy udnlc46e/2LZfWsyFyN/33aw7qhyWFuMuPBXEfX/qfXLk4IQfqBorrbtyS9e7qEII S66iJC+xMmqwbX+gmL99MI0S0BJDZDilZ7LZFc6BL33RLf4/0yKhNtkIHk6jOwGnR u9rnlK7rGD14fPUG8Q== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MYcpt-1rlbDS3zIx-00Vn85; Fri, 22 Dec 2023 13:03:10 +0100 Message-ID: <01446ce9-c0e8-4467-8b2d-fd736bc5b8e4@web.de> Date: Fri, 22 Dec 2023 13:03:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-GB To: Abel Vesa , Fabio Estevam , Michael Turquette , Peng Fan , Sascha Hauer , Shawn Guo , Stephen Boyd , kernel@pengutronix.de, linux-imx@nxp.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-janitors@vger.kernel.org Cc: LKML , cocci@inria.fr, Kuan-Wei Chiu From: Markus Elfring Subject: [PATCH] clk: imx: scu: Use common error handling code in imx_clk_scu_alloc_dev() X-Provags-ID: V03:K1:BGjso6szF5OPPe6YkYQSGx3cbiFicSuxRzUDu9gXysZ9LBV5Tvq Z6cTffdqrv7UHIX6aoglrjMVMIeKP5pSDKLNvjntsxJd+mL17ws3IVG0GKYnF+pS6T67QvK gr8PeMjPqAqlHHGSTj0e9Sv+JKROzNQdbR0YdGn46YScqYKsul9MgsPDHwT9q9FqJxmvmSL MRCmKAbKnhmhhobSBf3Qg== UI-OutboundReport: notjunk:1;M01:P0:C43S6QqDGms=;1AS+ngQDUXyBJhSI0PdTlWudgJL JisRmg3aLdq7ySUByZXyBe5ukinU/bozc+P/qge5y9ew5GD6hXlSanaVebEhIvK5moYeqaAyN jARiNJ8NQcxgL5JRcanHezbbpdhQauCgEfaO15WtywBI9L6/x2zhjYMhCJZzZTGtzt9a8aA+c IzsU18Tsew5MQZ1kKLmcWE5KK9WraLVAaOCzV2j4dd1SrfPHO1I+7LKYNX54eH3wjRgEokM0H cltYoCZ/ZQOINV0WjgYBJnK/41T4yBXRlY/jG+hffHdGCBp58di5Wm5Mnsa6yEDzezhx5g42o e+aVZlXPZCR5WFBKCiZc92bFrPTkLl8SMmS28l1/SzImDcxjIEAlJoj3cvZefNyesWt+d9YE8 SY5xhEQKB9nKAbgbNhzXYxk1WqcgphKaXKwO5XPH6wjwBDqYA8L6dqh+9q2WzuMLMqLgevj+l guU5+wrpnwYus5cVqXlg602wFAg7k2EHbcCppeGzUxvSqJh5OhZNj1AE06NFw8aotxiljQkyp Ai3M13CeYSk3YtkA7oYLnsDxuyZlUa3QkTjHHRBkgv9ZOczKaCy0HLAhFGP+KHmjX1VJ+u2Bc SipmOzNgd0gKQog7Fb3Pp9SbjRWzuYe6B25KYb+Lgur8f82pJMzYzQ3c0NAyIP9bKenH/TWM8 s4GEvRZlmLm/KqBNUsipS8f/JyLhHrlG1uQ+VEH1uMV+p+1MyLAXet8Fqo1kRaWhfXKKvKJgj a611lmi/E2kcO1J+mdPHaXo8EWR2fnD51ntCoonYMheu83cySK/J2XsB15IgGEeW1omMY1IZb rETu2YO1m6n3HTBmNc0u662Krt0AITpVXxvFAI6IuGxTSMcqKXAKU72osSR4sq4jARRe0qfi9 qixcAizdkwON+ZXaKKztKXHISzLcATiSZzVAZfqyDIpoixdbaIltFsZpdU27izUtjh8ylcGkq JgjelfK58dYaRUc0BOsYkU4sjiU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_040335_600874_F4B62C0E X-CRM114-Status: UNSURE ( 7.60 ) 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: Fri, 22 Dec 2023 12:56:48 +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 Reviewed-by: Peng Fan --- drivers/clk/imx/clk-scu.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) -- 2.43.0 diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index e48a904c0013..b1dd0c08e091 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -712,17 +712,13 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, } ret = platform_device_add_data(pdev, &clk, sizeof(clk)); - if (ret) { - platform_device_put(pdev); - return ERR_PTR(ret); - } + if (ret) + goto put_device; ret = driver_set_override(&pdev->dev, &pdev->driver_override, "imx-scu-clk", strlen("imx-scu-clk")); - if (ret) { - platform_device_put(pdev); - return ERR_PTR(ret); - } + if (ret) + goto put_device; ret = imx_clk_scu_attach_pd(&pdev->dev, rsrc_id); if (ret) @@ -730,13 +726,15 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, name, ret); ret = platform_device_add(pdev); - if (ret) { - platform_device_put(pdev); - return ERR_PTR(ret); - } + if (ret) + goto put_device; /* For API backwards compatiblilty, simply return NULL for success */ return NULL; + +put_device: + platform_device_put(pdev); + return ERR_PTR(ret); } void imx_clk_scu_unregister(void)