diff mbox series

[v2,1/2] clk: ingenic/jz4770: Exit with error if CGU init failed

Message ID 20200213161952.37460-1-paul@crapouillou.net (mailing list archive)
State Accepted, archived
Headers show
Series [v2,1/2] clk: ingenic/jz4770: Exit with error if CGU init failed | expand

Commit Message

Paul Cercueil Feb. 13, 2020, 4:19 p.m. UTC
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>
---

Notes:
    v2: Added Fixes: tag

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

Comments

Stephen Boyd March 21, 2020, 12:08 a.m. UTC | #1
Quoting Paul Cercueil (2020-02-13 08:19:51)
> 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>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/ingenic/jz4770-cgu.c b/drivers/clk/ingenic/jz4770-cgu.c
index 956dd653a43d..c051ecba5cf8 100644
--- a/drivers/clk/ingenic/jz4770-cgu.c
+++ b/drivers/clk/ingenic/jz4770-cgu.c
@@ -432,8 +432,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)