From: Stefan Roese Date: Tue, 9 Mar 2021 17:13:23 +0100 Subject: [PATCH v2 2/4] watchdog: Show error message when initr_watchdog() cannot start watchdog In-Reply-To: <20210309132657.25393-2-pali@kernel.org> References: <20210305213659.31025-1-pali@kernel.org> <20210309132657.25393-1-pali@kernel.org> <20210309132657.25393-2-pali@kernel.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 09.03.21 14:26, Pali Roh?r wrote: > 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 Reviewed-by: Stefan Roese Thanks, Stefan > --- > 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); > > Viele Gr??e, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de