From patchwork Fri Apr 19 18:15:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10909057 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 1728214DB for ; Fri, 19 Apr 2019 18:16:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B83128D3F for ; Fri, 19 Apr 2019 18:16:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F389928D98; Fri, 19 Apr 2019 18:16:15 +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=ham 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 E8D0228D97 for ; Fri, 19 Apr 2019 18:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726030AbfDSSQO (ORCPT ); Fri, 19 Apr 2019 14:16:14 -0400 Received: from sauhun.de ([88.99.104.3]:50518 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbfDSSQM (ORCPT ); Fri, 19 Apr 2019 14:16:12 -0400 Received: from localhost (p5486CC46.dip0.t-ipconnect.de [84.134.204.70]) by pokefinder.org (Postfix) with ESMTPSA id E39C92E3578; Fri, 19 Apr 2019 20:16:09 +0200 (CEST) From: Wolfram Sang To: linux-watchdog@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Guenter Roeck , Wolfram Sang , Wim Van Sebroeck , linux-kernel@vger.kernel.org Subject: [PATCH v3 02/16] watchdog: add error messages when initializing timeout fails Date: Fri, 19 Apr 2019 20:15:47 +0200 Message-Id: <20190419181601.7412-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190419181601.7412-1-wsa+renesas@sang-engineering.com> References: <20190419181601.7412-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. Reviewed-by: Guenter Roeck Signed-off-by: Wolfram Sang --- drivers/watchdog/watchdog_core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index 21e53cc49977..62be9e52a4de 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -115,6 +115,8 @@ static void watchdog_check_min_max_timeout(struct watchdog_device *wdd) int watchdog_init_timeout(struct watchdog_device *wdd, unsigned int timeout_parm, struct device *dev) { + const char *dev_str = wdd->parent ? dev_name(wdd->parent) : + (const char *)wdd->info->identity; unsigned int t = 0; int ret = 0; @@ -126,6 +128,8 @@ int watchdog_init_timeout(struct watchdog_device *wdd, wdd->timeout = timeout_parm; return 0; } + pr_err("%s: driver supplied timeout (%u) out of range\n", + dev_str, timeout_parm); ret = -EINVAL; } @@ -136,9 +140,14 @@ int watchdog_init_timeout(struct watchdog_device *wdd, wdd->timeout = t; return 0; } + pr_err("%s: DT supplied timeout (%u) out of range\n", dev_str, t); ret = -EINVAL; } + if (ret < 0 && wdd->timeout) + pr_warn("%s: falling back to default timeout (%u)\n", dev_str, + wdd->timeout); + return ret; } EXPORT_SYMBOL_GPL(watchdog_init_timeout);