public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/4] watchdog: Show error message when initr_watchdog() cannot start watchdog
Date: Tue,  9 Mar 2021 14:26:55 +0100	[thread overview]
Message-ID: <20210309132657.25393-2-pali@kernel.org> (raw)
In-Reply-To: <20210309132657.25393-1-pali@kernel.org>

Function wdt_start() may fail. So in initr_watchdog() function check return
value of wdt_start() call and print error message when watchdog starting
failed.

Signed-off-by: Pali Roh?r <pali@kernel.org>
---
 drivers/watchdog/wdt-uclass.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 3f707f61f74f..7500b3ed90e3 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -27,6 +27,7 @@ static ulong reset_period = 1000;
 int initr_watchdog(void)
 {
 	u32 timeout = WATCHDOG_TIMEOUT_SECS;
+	int ret;
 
 	/*
 	 * Init watchdog: This will call the probe function of the
@@ -50,7 +51,12 @@ int initr_watchdog(void)
 						    4 * reset_period) / 4;
 	}
 
-	wdt_start(gd->watchdog_dev, timeout * 1000, 0);
+	ret = wdt_start(gd->watchdog_dev, timeout * 1000, 0);
+	if (ret != 0) {
+		printf("WDT:   Failed to start\n");
+		return 0;
+	}
+
 	printf("WDT:   Started with%s servicing (%ds timeout)\n",
 	       IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout);
 
-- 
2.20.1

  reply	other threads:[~2021-03-09 13:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 21:36 [PATCH 1/4] watchdog: Set/unset GD_FLG_WDT_READY flag in wdt_start()/wdt_stop() Pali Rohár
2021-03-05 21:36 ` [PATCH 2/4] watchdog: Show error message when initr_watchdog() cannot start watchdog Pali Rohár
2021-03-09 11:27   ` Stefan Roese
2021-03-05 21:36 ` [PATCH 3/4] watchdog: Allow to use CONFIG_WDT without starting watchdog Pali Rohár
2021-03-09 11:33   ` Stefan Roese
2021-03-09 13:27     ` Pali Rohár
2021-03-09 16:12       ` Stefan Roese
2021-03-09 16:14         ` Pali Rohár
2021-03-05 21:36 ` [PATCH 4/4] arm: mvebu: Espressobin: Enable watchdog support but do not start it Pali Rohár
2021-03-09 11:34   ` Stefan Roese
2021-03-09 11:26 ` [PATCH 1/4] watchdog: Set/unset GD_FLG_WDT_READY flag in wdt_start()/wdt_stop() Stefan Roese
2021-03-09 13:26 ` [PATCH v2 " Pali Rohár
2021-03-09 13:26   ` Pali Rohár [this message]
2021-03-09 16:13     ` [PATCH v2 2/4] watchdog: Show error message when initr_watchdog() cannot start watchdog Stefan Roese
2021-03-09 13:26   ` [PATCH v2 3/4] watchdog: Allow to use CONFIG_WDT without starting watchdog Pali Rohár
2021-03-09 16:13     ` Stefan Roese
2021-03-09 13:26   ` [PATCH v2 4/4] arm: mvebu: Espressobin: Enable watchdog support but do not start it Pali Rohár
2021-03-09 16:13     ` Stefan Roese
2021-03-09 16:13   ` [PATCH v2 1/4] watchdog: Set/unset GD_FLG_WDT_READY flag in wdt_start()/wdt_stop() Stefan Roese
2021-04-06 10:28   ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210309132657.25393-2-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox