[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <22084283-6854-41f9-b45a-4b27ce207f76@web.de>
Date: Wed, 17 Jan 2024 18:42:57 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-clk@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Linus Walleij <linus.walleij@...aro.org>,
Michael Turquette <mturquette@...libre.com>, Rob Herring <robh@...nel.org>,
Stephen Boyd <sboyd@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH 2/2] clk: versatile: clk-icst: Use common error handling code
in icst_clk_setup()
From: Markus Elfring <elfring@...rs.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@...rs.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
Powered by blists - more mailing lists