| From fc202e48ac672f2bac84d2f88e0bbd26482673e5 Mon Sep 17 00:00:00 2001 |
| From: Paul Cercueil <paul@crapouillou.net> |
| Date: Thu, 13 Feb 2020 13:19:51 -0300 |
| Subject: [PATCH] clk: ingenic/jz4770: Exit with error if CGU init failed |
| |
| 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@vger.kernel.org |
| Signed-off-by: Paul Cercueil <paul@crapouillou.net> |
| Reported-by: kbuild test robot <lkp@intel.com> |
| Reported-by: Dan Carpenter <dan.carpenter@oracle.com> |
| Link: https://lkml.kernel.org/r/20200213161952.37460-1-paul@crapouillou.net |
| Signed-off-by: Stephen Boyd <sboyd@kernel.org> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/clk/ingenic/jz4770-cgu.c b/drivers/clk/ingenic/jz4770-cgu.c |
| index dfce740c25a8..c6f877d05af7 100644 |
| --- a/drivers/clk/ingenic/jz4770-cgu.c |
| +++ b/drivers/clk/ingenic/jz4770-cgu.c |
| @@ -437,8 +437,10 @@ static void __init jz4770_cgu_init(struct device_node *np) |
| |
| 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) |
| -- |
| 2.7.4 |
| |