Skip to content

Commit ad37467

Browse files
Chen NiWim Van Sebroeck
authored andcommitted
watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare
clk_prepare_enable() and clk_disable_unprepare() already checked NULL clock parameter.Remove unneeded NULL check for clk here. Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20250313084420.2481763-1-nichen@iscas.ac.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent c40524d commit ad37467

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/watchdog/npcm_wdt.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
6868
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
6969
u32 val;
7070

71-
if (wdt->clk)
72-
clk_prepare_enable(wdt->clk);
71+
clk_prepare_enable(wdt->clk);
7372

7473
if (wdd->timeout < 2)
7574
val = 0x800;
@@ -105,8 +104,7 @@ static int npcm_wdt_stop(struct watchdog_device *wdd)
105104

106105
writel(0, wdt->reg);
107106

108-
if (wdt->clk)
109-
clk_disable_unprepare(wdt->clk);
107+
clk_disable_unprepare(wdt->clk);
110108

111109
return 0;
112110
}
@@ -156,8 +154,7 @@ static int npcm_wdt_restart(struct watchdog_device *wdd,
156154
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
157155

158156
/* For reset, we start the WDT clock and leave it running. */
159-
if (wdt->clk)
160-
clk_prepare_enable(wdt->clk);
157+
clk_prepare_enable(wdt->clk);
161158

162159
writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg);
163160
udelay(1000);

0 commit comments

Comments
 (0)