mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-21 05:44:01 +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)
|
int clk_enable(struct clk *clk)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
if (!clk)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
spin_lock_irqsave(&clk_lock, flags);
|
spin_lock_irqsave(&clk_lock, flags);
|
||||||
if ((clk->enabled++ == 0) && clk->clk_ops)
|
if ((clk->enabled++ == 0) && clk->clk_ops)
|
||||||
clk->clk_ops->enable(clk);
|
clk->clk_ops->enable(clk);
|
||||||
|
|
Loading…
Add table
Reference in a new issue