[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1609079753-4038536-1-git-send-email-bodefang@126.com>
Date: Sun, 27 Dec 2020 22:35:53 +0800
From: Defang Bo <bodefang@....com>
To: gerg@...ux-m68k.org, geert@...ux-m68k.org
Cc: linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org,
Defang Bo <bodefang@....com>
Subject: [PATCH 2/2] m68k: let clk_enable() return immediately if clk is NULL
There should be a check for clk to prevent NULL pointer dereference.
Signed-off-by: Defang Bo <bodefang@....com>
---
arch/m68k/coldfire/clk.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index 7bc666e..cf1ed97 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -90,6 +90,9 @@ EXPORT_SYMBOL(clk_get);
int clk_enable(struct clk *clk)
{
unsigned long flags;
+ if (!clk)
+ return;
+
spin_lock_irqsave(&clk_lock, flags);
if ((clk->enabled++ == 0) && clk->clk_ops)
clk->clk_ops->enable(clk);
--
2.7.4
Powered by blists - more mailing lists