[PATCH 5.5 227/257] clk: ingenic/jz4770: Exit with error if CGU init failed

From: Greg Kroah-Hartman
Date: Thu Apr 16 2020 - 11:33:56 EST


From: Paul Cercueil <paul@xxxxxxxxxxxxxxx>

commit c067b46d731a764fc46ecc466c2967088c97089e upstream.

Exit jz4770_cgu_init() if the 'cgu' pointer we get is NULL, since the
pointer is passed as argument to functions later on.

Fixes: 7a01c19007ad ("clk: Add Ingenic jz4770 CGU driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Link: https://lkml.kernel.org/r/20200213161952.37460-1-paul@xxxxxxxxxxxxxxx
Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/clk/ingenic/jz4770-cgu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/clk/ingenic/jz4770-cgu.c
+++ b/drivers/clk/ingenic/jz4770-cgu.c
@@ -432,8 +432,10 @@ static void __init jz4770_cgu_init(struc

cgu = ingenic_cgu_new(jz4770_cgu_clocks,
ARRAY_SIZE(jz4770_cgu_clocks), np);
- if (!cgu)
+ if (!cgu) {
pr_err("%s: failed to initialise CGU\n", __func__);
+ return;
+ }

retval = ingenic_cgu_register_clocks(cgu);
if (retval)