Skip to contentSkip to conversation

clk: ingenic/jz4770: Exit with error if CGU init failed

PATCH Applied Paul Cercueil 2 participants 4 messages Feb 13, 2020 – Mar 21, 2020

Subsystems (3)
lore
Share & tools
lore

Paul Cercueil

author maintainer
#0 lore raw

PATCH v2 1/2 clk: ingenic/jz4770: Exit with error if CGU init failed

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")

---

Notes:
v2: Added Fixes: tag

 drivers/clk/ingenic/jz4770-cgu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/ingenic/jz4770-cgu.c +3 -1
index 956dd653a43d..c051ecba5cf8 100644
@@ -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)
Signature · 1 line
2.25.0
author maintainer
#1 lore raw

PATCH v2 2/2 clk: ingenic/TCU: Fix round_rate returning error

When requesting a rate superior to the parent's rate, it would return -EINVAL instead of simply returning the parent's rate like it should.

Fixes 4f89e4b8f121 ("clk: ingenic: Add driver for the TCU clocks")

---

Notes:
v2: New patch

 drivers/clk/ingenic/tcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/ingenic/tcu.c +1 -1
index ad7daa494fd4..cd537c3db782 100644
@@ -189,7 +189,7 @@ static long ingenic_tcu_round_rate(struct clk_hw *hw, unsigned long req_rate,
 	u8 prescale;
 
 	if (req_rate > rate)
-		return -EINVAL;
+		return rate;
 
 	prescale = ingenic_tcu_get_prescale(rate, req_rate);
 
Signature · 1 line
2.25.0
maintainer Applied
#3 lore raw
In reply to Paul Cercueil

Quoting Paul Cercueil (2020-02-13 08:19:51)

Quoted 9 lines

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")

---

Applied to clk-next

maintainer Applied
#2 lore raw

Re: [PATCH v2 2/2] clk: ingenic/TCU: Fix round_rate returning error

In reply to Paul Cercueil

Quoting Paul Cercueil (2020-02-13 08:19:52)

Quoted 7 lines

When requesting a rate superior to the parent's rate, it would return -EINVAL instead of simply returning the parent's rate like it should.

Fixes 4f89e4b8f121 ("clk: ingenic: Add driver for the TCU clocks")

---

Applied to clk-next