diff options
author | Defang Bo <bodefang@126.com> | 2020-12-28 10:07:45 +0800 |
---|---|---|
committer | Greg Ungerer <gerg@linux-m68k.org> | 2021-02-08 08:15:17 +1000 |
commit | c1fb1bf64bb63a1d6ae3311a9a3581a527c1f185 (patch) | |
tree | 787edf9c5221bff4891bb507a4863f730ad0ce93 /arch/m68k/coldfire/clk.c | |
parent | 92bf22614b21a2706f4993b278017e437f7785b3 (diff) |
m68k: let clk_enable() return immediately if clk is NULL
Similar to commit<742859adc721>("m68k: let clk_disable() return immediately if clk is NULL").
there should be a check for clk to prevent NULL pointer dereference.
Signed-off-by: Defang Bo <bodefang@126.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Diffstat (limited to 'arch/m68k/coldfire/clk.c')
-rw-r--r-- | arch/m68k/coldfire/clk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c index 7bc666e482eb..076a9caa9557 100644 --- a/arch/m68k/coldfire/clk.c +++ b/arch/m68k/coldfire/clk.c @@ -90,6 +90,10 @@ EXPORT_SYMBOL(clk_get); int clk_enable(struct clk *clk) { unsigned long flags; + + if (!clk) + return -EINVAL; + spin_lock_irqsave(&clk_lock, flags); if ((clk->enabled++ == 0) && clk->clk_ops) clk->clk_ops->enable(clk); |