Commit 01894d27 authored by Tony Lindgren's avatar Tony Lindgren Committed by Greg Kroah-Hartman

clk: ti: clkctrl: Fix returning uninitialized data

[ Upstream commit 41b3588dba6ef4b7995735a97e47ff0aeea6c276 ]

If we do a clk_get() for a clock that does not exists, we have
_ti_omap4_clkctrl_xlate() return uninitialized data if no match
is found. This can be seen in some cases with SLAB_DEBUG enabled:

Unable to handle kernel paging request at virtual address 5a5a5a5a

Let's fix this by setting a found flag only when we find a match.
Reported-by: default avatarTomi Valkeinen <>
Fixes: 88a17252 ("clk: ti: add support for clkctrl clocks")
Signed-off-by: default avatarTony Lindgren <>
Tested-by: default avatarPeter Ujfalusi <>
Tested-by: default avatarTomi Valkeinen <>
Signed-off-by: default avatarStephen Boyd <>
Signed-off-by: default avatarSasha Levin <>
parent 8fe38c0e
......@@ -215,6 +215,7 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
struct omap_clkctrl_provider *provider = data;
struct omap_clkctrl_clk *entry;
bool found = false;
if (clkspec->args_count != 2)
return ERR_PTR(-EINVAL);
......@@ -224,11 +225,13 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
list_for_each_entry(entry, &provider->clocks, node) {
if (entry->reg_offset == clkspec->args[0] &&
entry->bit_offset == clkspec->args[1])
entry->bit_offset == clkspec->args[1]) {
found = true;
if (!entry)
if (!found)
return ERR_PTR(-EINVAL);
return entry->clk;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment