[PATCH 5.10.y-cip 16/24] clk: renesas: rzg2l: Fix return value and unused assignment


Lad Prabhakar
 

From: Yang Li <yang.lee@linux.alibaba.com>

commit 97c29755598f98c6c91f68f12bdd3f517e457890 upstream.

Currently the function returns NULL on error, so exact error code is
lost. This patch changes return convention of the function to use
ERR_PTR() on error instead.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/1623896524-102058-1-git-send-email-yang.lee@linux.alibaba.com
[geert: Drop curly braces]
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/clk/renesas/renesas-rzg2l-cpg.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c
index a0bb8b20797d..0ce84a24198c 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
@@ -182,10 +182,8 @@ rzg2l_cpg_pll_clk_register(const struct cpg_core_clk *core,
return ERR_CAST(parent);

pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL);
- if (!pll_clk) {
- clk = ERR_PTR(-ENOMEM);
- return NULL;
- }
+ if (!pll_clk)
+ return ERR_PTR(-ENOMEM);

parent_name = __clk_get_name(parent);
init.name = core->name;
--
2.17.1

Join cip-dev@lists.cip-project.org to automatically receive all group messages.