mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-clk@vger.kernel.org, David Lechner <david@lechnology.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Nishka Dasgupta <nishkadg.linux@gmail.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] clk: davinci: Use common error handling code in of_davinci_pll_init()
Date: Tue, 17 Sep 2024 15:10:32 +0200	[thread overview]
Message-ID: <79d31fe5-6ec1-4e40-be5f-85e1f61811c1@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Sep 2024 15:00:53 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function implementation.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/davinci/pll.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/davinci/pll.c b/drivers/clk/davinci/pll.c
index 5bbbb3a66477..eb79424f216d 100644
--- a/drivers/clk/davinci/pll.c
+++ b/drivers/clk/davinci/pll.c
@@ -777,16 +777,13 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
 		int i;

 		clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
-		if (!clk_data) {
-			of_node_put(child);
-			return -ENOMEM;
-		}
+		if (!clk_data)
+			goto put_node;

 		clks = kmalloc_array(n_clks, sizeof(*clks), GFP_KERNEL);
 		if (!clks) {
 			kfree(clk_data);
-			of_node_put(child);
-			return -ENOMEM;
+			goto put_node;
 		}

 		clk_data->clks = clks;
@@ -838,6 +835,10 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
 	of_node_put(child);

 	return 0;
+
+put_node:
+	of_node_put(child);
+	return -ENOMEM;
 }

 static struct davinci_pll_platform_data *davinci_pll_get_pdata(struct device *dev)
--
2.46.0


                 reply	other threads:[~2024-09-17 13:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=79d31fe5-6ec1-4e40-be5f-85e1f61811c1@web.de \
    --to=markus.elfring@web.de \
    --cc=david@lechnology.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=nishkadg.linux@gmail.com \
    --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

all inboxes | Powered by JetHome®