Skip to content

Commit 854478a

Browse files
eichenbergerWim Van Sebroeck
authored andcommitted
watchdog: imx_sc_wdt: fix pretimeout
If the WDIOF_PRETIMEOUT flag is not set when registering the device the driver will not show the sysfs entries or register the default governor. By moving the registering after the decision whether pretimeout is supported this gets fixed. Signed-off-by: Stefan Eichenberger <eichest@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Link: https://lore.kernel.org/r/20210519080311.142928-1-eichest@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent 266b2e3 commit 854478a

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

drivers/watchdog/imx_sc_wdt.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,12 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
183183
watchdog_stop_on_reboot(wdog);
184184
watchdog_stop_on_unregister(wdog);
185185

186-
ret = devm_watchdog_register_device(dev, wdog);
187-
if (ret)
188-
return ret;
189-
190186
ret = imx_scu_irq_group_enable(SC_IRQ_GROUP_WDOG,
191187
SC_IRQ_WDOG,
192188
true);
193189
if (ret) {
194190
dev_warn(dev, "Enable irq failed, pretimeout NOT supported\n");
195-
return 0;
191+
goto register_device;
196192
}
197193

198194
imx_sc_wdd->wdt_notifier.notifier_call = imx_sc_wdt_notify;
@@ -203,7 +199,7 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
203199
false);
204200
dev_warn(dev,
205201
"Register irq notifier failed, pretimeout NOT supported\n");
206-
return 0;
202+
goto register_device;
207203
}
208204

209205
ret = devm_add_action_or_reset(dev, imx_sc_wdt_action,
@@ -213,7 +209,8 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
213209
else
214210
dev_warn(dev, "Add action failed, pretimeout NOT supported\n");
215211

216-
return 0;
212+
register_device:
213+
return devm_watchdog_register_device(dev, wdog);
217214
}
218215

219216
static int __maybe_unused imx_sc_wdt_suspend(struct device *dev)

0 commit comments

Comments
 (0)