public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh@kernel.org>, Stephen Boyd <sboyd@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Kunwu Chan <chentao@kylinos.cn>
Subject: [PATCH 2/2] clk: versatile: clk-icst: Use common error handling code in icst_clk_setup()
Date: Wed, 17 Jan 2024 18:42:57 +0100	[thread overview]
Message-ID: <22084283-6854-41f9-b45a-4b27ce207f76@web.de> (raw)
In-Reply-To: <061aef8b-a41f-4346-af6e-560c7594b27b@web.de>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 17 Jan 2024 18:18:25 +0100

Add a jump target so that a bit of exception handling can be better reused
in an if branch of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/versatile/clk-icst.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index c4cf50a48972..9957dc9b8941 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -351,8 +351,8 @@ struct clk *icst_clk_setup(struct device *dev,

 	pclone = kmemdup(desc->params, sizeof(*pclone), GFP_KERNEL);
 	if (!pclone) {
-		kfree(icst);
-		return ERR_PTR(-ENOMEM);
+		clk = ERR_PTR(-ENOMEM);
+		goto free_icst;
 	}

 	init.name = name;
@@ -370,6 +370,7 @@ struct clk *icst_clk_setup(struct device *dev,
 	clk = clk_register(dev, &icst->hw);
 	if (IS_ERR(clk)) {
 		kfree(pclone);
+free_icst:
 		kfree(icst);
 	}

--
2.43.0


      parent reply	other threads:[~2024-01-17 17:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 17:40 [PATCH 0/2] versatile clock: Adjustments for two function implementations Markus Elfring
2024-01-17 17:41 ` [PATCH 1/2] clk: versatile: clk-icst: Return directly after a failed kasprintf() call in of_syscon_icst_setup() Markus Elfring
2024-01-17 17:42 ` Markus Elfring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22084283-6854-41f9-b45a-4b27ce207f76@web.de \
    --to=markus.elfring@web.de \
    --cc=chentao@kylinos.cn \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox