* [PATCH] clk: mux: Return a sane value on error
@ 2013-10-21 8:59 Russ Dill
2013-10-30 19:47 ` Mike Turquette
0 siblings, 1 reply; 2+ messages in thread
From: Russ Dill @ 2013-10-21 8:59 UTC (permalink / raw)
To: linux-arm-kernel
The get_parent op is defined as returning u8, but clk-mux is
returning negative values on error. Code within drivers/clk/clk.c
uses this return value as an index into an array which could
cause an oops.
Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
drivers/clk/clk-mux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index 4f96ff3..cc06015 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -51,7 +51,7 @@ static u8 clk_mux_get_parent(struct clk_hw *hw)
for (i = 0; i < num_parents; i++)
if (mux->table[i] == val)
return i;
- return -EINVAL;
+ return 0;
}
if (val && (mux->flags & CLK_MUX_INDEX_BIT))
@@ -61,7 +61,7 @@ static u8 clk_mux_get_parent(struct clk_hw *hw)
val--;
if (val >= num_parents)
- return -EINVAL;
+ return 0;
return val;
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] clk: mux: Return a sane value on error
2013-10-21 8:59 [PATCH] clk: mux: Return a sane value on error Russ Dill
@ 2013-10-30 19:47 ` Mike Turquette
0 siblings, 0 replies; 2+ messages in thread
From: Mike Turquette @ 2013-10-30 19:47 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Russ Dill (2013-10-21 01:59:50)
> The get_parent op is defined as returning u8, but clk-mux is
> returning negative values on error. Code within drivers/clk/clk.c
> uses this return value as an index into an array which could
> cause an oops.
>
> Signed-off-by: Russ Dill <Russ.Dill@ti.com>
Hi Russ,
Thanks for the fix. Haojian Zhuang sent an identical fix the day before
you so I took his in ;-)
Regards,
Mike
> ---
> drivers/clk/clk-mux.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
> index 4f96ff3..cc06015 100644
> --- a/drivers/clk/clk-mux.c
> +++ b/drivers/clk/clk-mux.c
> @@ -51,7 +51,7 @@ static u8 clk_mux_get_parent(struct clk_hw *hw)
> for (i = 0; i < num_parents; i++)
> if (mux->table[i] == val)
> return i;
> - return -EINVAL;
> + return 0;
> }
>
> if (val && (mux->flags & CLK_MUX_INDEX_BIT))
> @@ -61,7 +61,7 @@ static u8 clk_mux_get_parent(struct clk_hw *hw)
> val--;
>
> if (val >= num_parents)
> - return -EINVAL;
> + return 0;
>
> return val;
> }
> --
> 1.8.3.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-30 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21 8:59 [PATCH] clk: mux: Return a sane value on error Russ Dill
2013-10-30 19:47 ` Mike Turquette
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).