From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753406AbbH2Tdk (ORCPT ); Sat, 29 Aug 2015 15:33:40 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:57267 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752423AbbH2Tc4 (ORCPT ); Sat, 29 Aug 2015 15:32:56 -0400 From: Guenter Roeck To: linux-watchdog@vger.kernel.org Cc: Wim Van Sebroeck , linux-kernel@vger.kernel.org, Timo Kokkonen , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-doc@vger.kernel.org, Jonathan Corbet , Guenter Roeck Subject: [PATCH v3 9/9] watchdog: Always evaluate new timeout against min_timeout Date: Sat, 29 Aug 2015 12:32:38 -0700 Message-Id: <1440876758-28047-10-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440876758-28047-1-git-send-email-linux@roeck-us.net> References: <1440876758-28047-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Up to now, a new timeout value is only evaluated against min_timeout if max_timeout is provided. This does not really make sense; a driver can have a minimum timeout even if it does not have a maximum timeout. Ensure that it is not smaller than min_timeout, even if max_timeout is not set. Signed-off-by: Guenter Roeck --- v3: New patch --- include/linux/watchdog.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 5c7d0e9e1f3f..0d95b3a21556 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h @@ -141,9 +141,9 @@ static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool noway /* Use the following function to check if a timeout value is invalid */ static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) { - return t > UINT_MAX / 1000 || + return t > UINT_MAX / 1000 || t < wdd->min_timeout || (!wdd->max_hw_timeout_ms && wdd->max_timeout && - (t < wdd->min_timeout || t > wdd->max_timeout)); + t > wdd->max_timeout); } /* Use the following functions to manipulate watchdog driver specific data */ -- 2.1.4