@@ -232,8 +232,11 @@ static int da9062_wdt_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, wdt);
irq = platform_get_irq_byname(pdev, "WDG_WARN");
- if (irq < 0)
+ if (irq < 0) {
dev_err(wdt->hw->dev, "Failed to get IRQ.\n");
+ ret = irq;
+ goto error;
+ }
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
da9062_wdt_wdg_warn_irq_handler,
@@ -242,20 +245,23 @@ static int da9062_wdt_probe(struct platform_device *pdev)
if (ret) {
dev_err(wdt->hw->dev,
"Failed to request watchdog device IRQ.\n");
+ goto error;
}
ret = watchdog_register_device(&wdt->wdtdev);
- if (ret < 0)
+ if (ret < 0) {
dev_err(wdt->hw->dev,
"watchdog registration incomplete (%d)\n", ret);
+ goto error;
+ }
da9062_set_window_start(wdt);
ret = da9062_wdt_ping(&wdt->wdtdev);
if (ret < 0)
- dev_err(wdt->hw->dev,
- "failed to ping the watchdog (%d)\n", ret);
+ watchdog_unregister_device(&wdt->wdtdev);
+error:
return ret;
}