Skip to content

Commit 15f0f6d

Browse files
srneeliWim Van Sebroeck
authored andcommitted
watchdog: of_xilinx_wdt: Remove unnecessary clock disable call in the remove path
There is a mismatch in axi clock enable and disable calls. The axi clock is enabled and disabled by the probe function, then it is again disabled in the remove path. So observed the call trace while removing the module. Use the clk_enable() and devm_clk_get_prepared() functions instead of devm_clk_get_enable() to avoid an extra clock disable call from the remove path. Call trace: clk_core_disable+0xb0/0xc0 clk_disable+0x30/0x4c clk_disable_unprepare+0x18/0x30 devm_clk_release+0x24/0x40 devres_release_all+0xc8/0x190 device_unbind_cleanup+0x18/0x6c device_release_driver_internal+0x20c/0x250 device_release_driver+0x18/0x24 bus_remove_device+0x124/0x130 device_del+0x174/0x440 Fixes: b6bc416 ("watchdog: of_xilinx_wdt: Add support for reading freq via CCF") Signed-off-by: Srinivas Neeli <srinivas.neeli@amd.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230901070929.1317982-1-ruanjinjie@huawei.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent bdb9701 commit 15f0f6d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/watchdog/of_xilinx_wdt.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static int xwdt_probe(struct platform_device *pdev)
187187

188188
watchdog_set_nowayout(xilinx_wdt_wdd, enable_once);
189189

190-
xdev->clk = devm_clk_get_enabled(dev, NULL);
190+
xdev->clk = devm_clk_get_prepared(dev, NULL);
191191
if (IS_ERR(xdev->clk)) {
192192
if (PTR_ERR(xdev->clk) != -ENOENT)
193193
return PTR_ERR(xdev->clk);
@@ -218,18 +218,25 @@ static int xwdt_probe(struct platform_device *pdev)
218218
spin_lock_init(&xdev->spinlock);
219219
watchdog_set_drvdata(xilinx_wdt_wdd, xdev);
220220

221+
rc = clk_enable(xdev->clk);
222+
if (rc) {
223+
dev_err(dev, "unable to enable clock\n");
224+
return rc;
225+
}
226+
221227
rc = xwdt_selftest(xdev);
222228
if (rc == XWT_TIMER_FAILED) {
223229
dev_err(dev, "SelfTest routine error\n");
230+
clk_disable(xdev->clk);
224231
return rc;
225232
}
226233

234+
clk_disable(xdev->clk);
235+
227236
rc = devm_watchdog_register_device(dev, xilinx_wdt_wdd);
228237
if (rc)
229238
return rc;
230239

231-
clk_disable(xdev->clk);
232-
233240
dev_info(dev, "Xilinx Watchdog Timer with timeout %ds\n",
234241
xilinx_wdt_wdd->timeout);
235242

0 commit comments

Comments
 (0)