From patchwork Sun Apr 14 10:26:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10899747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3364F49E3 for ; Sun, 14 Apr 2019 10:26:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 210382852C for ; Sun, 14 Apr 2019 10:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1531A28B36; Sun, 14 Apr 2019 10:26:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2FC72852C for ; Sun, 14 Apr 2019 10:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726598AbfDNK0f (ORCPT ); Sun, 14 Apr 2019 06:26:35 -0400 Received: from sauhun.de ([88.99.104.3]:32890 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbfDNK0f (ORCPT ); Sun, 14 Apr 2019 06:26:35 -0400 Received: from localhost (p5486CDCF.dip0.t-ipconnect.de [84.134.205.207]) by pokefinder.org (Postfix) with ESMTPSA id 7EF894A1351; Sun, 14 Apr 2019 12:26:33 +0200 (CEST) From: Wolfram Sang To: linux-watchdog@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang Subject: [PATCH 02/16] watchdog: add error messages when initializing timeout fails Date: Sun, 14 Apr 2019 12:26:13 +0200 Message-Id: <20190414102627.5564-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190414102627.5564-1-wsa+renesas@sang-engineering.com> References: <20190414102627.5564-1-wsa+renesas@sang-engineering.com> Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This not only removes boilerplate code from watchdog drivers, it can also be more specific which of the supplied value actually fails. Also, the loglevel becomes now consistent across drivers. Signed-off-by: Wolfram Sang --- drivers/watchdog/watchdog_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index 85c136acc0e9..407a5ca121d7 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -124,6 +124,8 @@ int watchdog_init_timeout(struct watchdog_device *wdd, wdd->timeout = timeout_parm; return 0; } + dev_err(dev, "driver supplied timeout (%u) out of range\n", + timeout_parm); ret = -EINVAL; } @@ -134,9 +136,13 @@ int watchdog_init_timeout(struct watchdog_device *wdd, wdd->timeout = t; return 0; } + dev_err(dev, "DT supplied timeout (%u) out of range\n", t); ret = -EINVAL; } + if (ret < 0 && wdd->timeout) + dev_warn(dev, "falling back to default timeout (%u)\n", wdd->timeout); + return ret; } EXPORT_SYMBOL_GPL(watchdog_init_timeout);