linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed
@ 2020-02-13 16:19 Paul Cercueil
  2020-02-13 16:19 ` [PATCH v2 2/2] clk: ingenic/TCU: Fix round_rate returning error Paul Cercueil
  2020-03-21  0:08 ` [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Cercueil @ 2020-02-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: od, linux-clk, linux-kernel, Paul Cercueil, stable,
	kbuild test robot, Dan Carpenter

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

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] clk: ingenic/TCU: Fix round_rate returning error
  2020-02-13 16:19 [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed Paul Cercueil
@ 2020-02-13 16:19 ` Paul Cercueil
  2020-03-21  0:08   ` Stephen Boyd
  2020-03-21  0:08 ` [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed Stephen Boyd
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Cercueil @ 2020-02-13 16:19 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: od, linux-clk, linux-kernel, Paul Cercueil, stable

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")
Cc: stable@vger.kernel.org
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---

Notes:
    v2: New patch

 drivers/clk/ingenic/tcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c
index ad7daa494fd4..cd537c3db782 100644
--- a/drivers/clk/ingenic/tcu.c
+++ b/drivers/clk/ingenic/tcu.c
@@ -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);
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed
  2020-02-13 16:19 [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed Paul Cercueil
  2020-02-13 16:19 ` [PATCH v2 2/2] clk: ingenic/TCU: Fix round_rate returning error Paul Cercueil
@ 2020-03-21  0:08 ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-03-21  0:08 UTC (permalink / raw)
  To: Michael Turquette, Paul Cercueil, Stephen Boyd
  Cc: od, linux-clk, linux-kernel, Paul Cercueil, stable,
	kbuild test robot, Dan Carpenter

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] clk: ingenic/TCU: Fix round_rate returning error
  2020-02-13 16:19 ` [PATCH v2 2/2] clk: ingenic/TCU: Fix round_rate returning error Paul Cercueil
@ 2020-03-21  0:08   ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-03-21  0:08 UTC (permalink / raw)
  To: Michael Turquette, Paul Cercueil, Stephen Boyd
  Cc: od, linux-clk, linux-kernel, Paul Cercueil, stable

Quoting Paul Cercueil (2020-02-13 08:19:52)
> 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")
> Cc: stable@vger.kernel.org
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-21  0:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 16:19 [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed Paul Cercueil
2020-02-13 16:19 ` [PATCH v2 2/2] clk: ingenic/TCU: Fix round_rate returning error Paul Cercueil
2020-03-21  0:08   ` Stephen Boyd
2020-03-21  0:08 ` [PATCH v2 1/2] clk: ingenic/jz4770: Exit with error if CGU init failed Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).