linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent
@ 2018-07-13 10:27 Gregory CLEMENT
  2018-07-25 16:43 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Gregory CLEMENT @ 2018-07-13 10:27 UTC (permalink / raw)
  To: linux-arm-kernel

The return value of the get_parent operation is a u8, whereas a -EINVAL
was returned. This wrong value was return if the value was bigger that
the number of parent but this case was already handled by the core.

So we can just remove this chunk of code to fix the issue.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 9818a7a4fd10 ("clk: mvebu: armada-37xx-periph: prepare cpu clk to
be used with DVFS")
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 drivers/clk/mvebu/armada-37xx-periph.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c
index a51edaab0c5c..287e98a7cff4 100644
--- a/drivers/clk/mvebu/armada-37xx-periph.c
+++ b/drivers/clk/mvebu/armada-37xx-periph.c
@@ -426,9 +426,6 @@ static u8 clk_pm_cpu_get_parent(struct clk_hw *hw)
 		val &= pm_cpu->mask_mux;
 	}
 
-	if (val >= num_parents)
-		return -EINVAL;
-
 	return val;
 }
 
-- 
2.18.0

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

* [PATCH] clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent
  2018-07-13 10:27 [PATCH] clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent Gregory CLEMENT
@ 2018-07-25 16:43 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2018-07-25 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Gregory CLEMENT (2018-07-13 03:27:26)
> The return value of the get_parent operation is a u8, whereas a -EINVAL
> was returned. This wrong value was return if the value was bigger that
> the number of parent but this case was already handled by the core.
> 
> So we can just remove this chunk of code to fix the issue.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 9818a7a4fd10 ("clk: mvebu: armada-37xx-periph: prepare cpu clk to
> be used with DVFS")
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---

Applied to clk-next

This is actually a good point I've never considered. We should go fix
all the drivers that return a negative value to return a number that's
greater than the number of clks that are the parents and then we can
still get 'errors' from this clk_op.

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

end of thread, other threads:[~2018-07-25 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-13 10:27 [PATCH] clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent Gregory CLEMENT
2018-07-25 16:43 ` 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).