mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 18:12:48 +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 <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user