diff options
author | Defang Bo <bodefang@126.com> | 2020-12-28 03:07:45 +0100 |
---|---|---|
committer | Greg Ungerer <gerg@linux-m68k.org> | 2021-02-07 23:15:17 +0100 |
commit | c1fb1bf64bb63a1d6ae3311a9a3581a527c1f185 (patch) | |
tree | 787edf9c5221bff4891bb507a4863f730ad0ce93 /arch/m68k | |
parent | Linux 5.11-rc7 (diff) | |
download | linux-c1fb1bf64bb63a1d6ae3311a9a3581a527c1f185.tar.xz linux-c1fb1bf64bb63a1d6ae3311a9a3581a527c1f185.zip |
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')
-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); |