Skip to content

Commit c1fb1bf

Browse files
Defang BoGreg Ungerer
authored andcommitted
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>
1 parent 92bf226 commit c1fb1bf

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/m68k/coldfire/clk.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ EXPORT_SYMBOL(clk_get);
9090
int clk_enable(struct clk *clk)
9191
{
9292
unsigned long flags;
93+
94+
if (!clk)
95+
return -EINVAL;
96+
9397
spin_lock_irqsave(&clk_lock, flags);
9498
if ((clk->enabled++ == 0) && clk->clk_ops)
9599
clk->clk_ops->enable(clk);

0 commit comments

Comments
 (0)