All of lore.kernel.org
 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
  0 siblings, 0 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2018-07-13 10:27 UTC (permalink / raw)
  To: Stephen Boyd, Mike Turquette, linux-clk, linux-kernel
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel,
	Antoine Tenart, Miquèl Raynal, Maxime Chevallier,
	Nadav Haklai, Victor Gu, Marcin Wojtas, Wilson Ding, Hua Jing,
	Neta Zur Hershkovits, Ken Ma

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] 5+ messages in thread

* [PATCH] clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent
@ 2018-07-13 10:27 ` Gregory CLEMENT
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

* Re: [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
  -1 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2018-07-25 16:43 UTC (permalink / raw)
  To: Gregory CLEMENT, Mike Turquette, Stephen Boyd, linux-clk, linux-kernel
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel,
	Antoine Tenart, Miquèl Raynal, Maxime Chevallier,
	Nadav Haklai, Victor Gu, Marcin Wojtas, Wilson Ding, Hua Jing,
	Neta Zur Hershkovits, Ken Ma

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] 5+ messages in thread

* Re: [PATCH] clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent
@ 2018-07-25 16:43   ` Stephen Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2018-07-25 16:43 UTC (permalink / raw)
  To: Gregory CLEMENT, Mike Turquette, Stephen Boyd, linux-clk, linux-kernel
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel,
	Antoine Tenart, Miquèl Raynal, Maxime Chevallier,
	Nadav Haklai, Victor Gu, Marcin Wojtas, Wilson Ding, Hua Jing,
	Neta Zur Hershkovits, Ken Ma

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] 5+ messages in thread

* [PATCH] clk: mvebu: armada-37xx-periph: Fix wrong return value in get_parent
@ 2018-07-25 16:43   ` Stephen Boyd
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

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

Thread overview: 5+ 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-13 10:27 ` Gregory CLEMENT
2018-07-25 16:43 ` Stephen Boyd
2018-07-25 16:43   ` Stephen Boyd
2018-07-25 16:43   ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.