mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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>
This commit is contained in:
parent
92bf22614b
commit
c1fb1bf64b
1 changed files with 4 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue