From patchwork Fri Mar 5 21:36:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1448264 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=EjkuVcWU; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dsh0m4bP1z9sW1 for ; Sat, 6 Mar 2021 08:37:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6FFD882462; Fri, 5 Mar 2021 22:37:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="EjkuVcWU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 02AE382016; Fri, 5 Mar 2021 22:37:24 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6131480F58 for ; Fri, 5 Mar 2021 22:37:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id D2AF2650A9; Fri, 5 Mar 2021 21:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614980240; bh=Cjmlnth33N7e8Q4TfAVkhixk9VVXuBsRBexCSIXiyHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EjkuVcWUiE/GytOh3IkzhAFSaUjeiZFzhU2mQb8+/ukiyPnK4fW0zKIijOaPlYgLJ j6gontnGsZ28++9ldM38bwR/V1x6QMAB7EjVUGBLZvMYGf6x7k4+fNWpWNwxMxEgWg +vjeXac2BqXtWw4jWqQ4xAQmkts/33BMrLjwsGsS3DVTWYnY3SsZQ+BiQdoUcXlw2f 8vpgr4MLky8fqThVluHEGcOU/y4jXg87BVHyjnfq7+2+E2vo/QkAfzO/cFUusiZG7L 7wtkbHMXN/fGpjPlcqYNtrgCwWQakE85ZsPw+JOGVHC9W8+5+7EIpk8KNRCtC5O5A3 rt5q1KGBc2wxw== Received: by pali.im (Postfix) id 2B3E1105A; Fri, 5 Mar 2021 22:37:18 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Stefan Roese , Simon Glass , Maxim Sloyko , Konstantin Porotchkin Cc: u-boot@lists.denx.de, =?utf-8?q?Marek_Beh=C3=BAn?= , Andre Heider , Luka Kovacic Subject: [PATCH 2/4] watchdog: Show error message when initr_watchdog() cannot start watchdog Date: Fri, 5 Mar 2021 22:36:57 +0100 Message-Id: <20210305213659.31025-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210305213659.31025-1-pali@kernel.org> References: <20210305213659.31025-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean 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 --- 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);