From patchwork Sat Apr 17 03:42:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 12209519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66C71C433B4 for ; Sat, 17 Apr 2021 03:45:01 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E896A6115B for ; Sat, 17 Apr 2021 03:45:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E896A6115B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=OFPyRN5HjEEz6waklCXmQcRrAdbJmjj5xz4w9rqjiP4=; b=juBIx9piZEHnjKe1G27PaXV5VF WW1dHFk+RlcBUMae+u/892DVBq3xrKYrn/B8vNB5FOJqC2TfyufaP1pfUZvdn6MwH7/9sr6Vu8OcX cLimOgCPjV58HVVnbPJjmAEPTsB9R5LQ+EIp79UGb8RwDQ0D2fmDJX1tHK7hf2u6FuV2bUjsZOYTU eQnqoIjyIpOT3VVGDdMBDcZA4qYy5+SfSqC+aQK7I9miXPYNGYUGD8dfVtymd1qxrSX0E+C7zfeWq p0yZQZeiL5A67USHgBtvQKtOkYwyKStnzxCQK74ohYQHL6JjKRpcw71wF/FriAqfvFfkUYKm/0ncO 0daBtVzg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lXbrR-004ERc-Ax; Sat, 17 Apr 2021 03:43:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lXbrM-004ER4-H5 for linux-arm-kernel@desiato.infradead.org; Sat, 17 Apr 2021 03:43:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=KEgAGlMIMGSD4Y3PLpFSkmFQK4X2O5FS+oaEvb1q+lY=; b=Ls+V/68CNdwSmoIIIEw+gQmXpP +KlEKLfR2/M2u8TctuLa9Ss/iBsFgeY+B+rsVbLXAA12xMnR9AO//K6I3BMUvaRyBdhEPHd6nvUq/ nhMXJnbOdUpRvptFv92f7Wl5kYNYa5UwLoc3z1wBk3SSSul7Wif2uVay17XQXSquFPzmTYLrrS8y6 isWMEGAeGK+Ll1XU+g33uuRV54+/Jyn+LlELWeViETbORubDog0EmU9qt8PJmzWropWddTEXIBwXL SQ/IezSfqGvEYva5M37nDE4ufGAIJYPioLjR6+GJuimVJ/xjKTXjRyo7lZjaMLDiDJBcSxMRkU+A5 3CueKEJA==; Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lXbrI-009qel-5L for linux-arm-kernel@lists.infradead.org; Sat, 17 Apr 2021 03:43:03 +0000 Received: by mail-pf1-x42a.google.com with SMTP id m11so19592343pfc.11 for ; Fri, 16 Apr 2021 20:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=KEgAGlMIMGSD4Y3PLpFSkmFQK4X2O5FS+oaEvb1q+lY=; b=K0b5nLAizD7TGQDjgaOycW3pVacY3L7Ep+L1M4RObdMN2U6homi3AL+6ANBGRcLLyP wk2KHAqRuihRNK6M8acRbWXEB0Yl5BTqeVmylR0C3oBJkWqwK/TMaIKX9RziEPXg30as njFyJGypqwQaTqgu51A9+FAsuVyKn9MV7JecT/nWsdZrWboOJ9fWObm2t0QhjdsHZUaJ nNQceK0PgPxSCKW8hCWNwXpGqh0yWzx/fhIG7ta341FjY68/Gbaz4qLCPTvlRk4JyIwX R9r/KuAf3Fa3rKTMMiOOp7VTE/aytP8eME68cR+Kq4UukzCmlj+h07YXZOeBOhnirMgu WcQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KEgAGlMIMGSD4Y3PLpFSkmFQK4X2O5FS+oaEvb1q+lY=; b=Sk6Kt7wldPf06XeEvuxrTTCv5MLbLkRh+beCZTsdOSU+DqlOZj2gr2+nT1Gb802pJi m71aPMq42a0XKU4EYOHDI19SsUu893vCk9Ki1fgIBKv4Fq7th9cARsXPR9o7fEJa6brL 9HKFikXdQMIpB57QqG4dzTy1O/VyzL8AmnjEvfRsYCpmeHXMfm5fTPCbNCvNb1kTUTZ0 p/NLG+CSrCAsZQIc2Aq/xGwXR2OuiYDC+JK19N3cp9kKj9be4dRFh59ceKJ/N2diUj5I vlf98abn9leCNO1Erl35XunRBk+DdPxgz+p/bvUZiqaoMi40ZNjPsUDeIC4aSWhcZBqn Bg7A== X-Gm-Message-State: AOAM531Dyu/FksjRFoUsxaqbQXUouX5r1QstlW6vxhZl0tyy9YuqWRbC jllw/jLxw4gUOmxn2D7OUmw= X-Google-Smtp-Source: ABdhPJz8p4ON3M1hNgneJYgt8P2lIK0ojWFajm7V/CS2x1h65e9dsl/vMa9ItbnRupxHrr2DLFfO/g== X-Received: by 2002:a63:c14c:: with SMTP id p12mr1872172pgi.417.1618630977196; Fri, 16 Apr 2021 20:42:57 -0700 (PDT) Received: from taoren-ubuntu-R90MNF91.thefacebook.com (c-73-252-146-110.hsd1.ca.comcast.net. [73.252.146.110]) by smtp.gmail.com with ESMTPSA id f18sm4434821pfk.144.2021.04.16.20.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 20:42:56 -0700 (PDT) From: rentao.bupt@gmail.com To: Wim Van Sebroeck , Guenter Roeck , Joel Stanley , Andrew Jeffery , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, Tao Ren , Amithash Prasad Cc: Tao Ren Subject: [PATCH] watchdog: aspeed: fix hardware timeout calculation Date: Fri, 16 Apr 2021 20:42:49 -0700 Message-Id: <20210417034249.5978-1-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210416_204300_226971_E2A9558A X-CRM114-Status: GOOD ( 11.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tao Ren Fix hardware timeout calculation in aspeed_wdt_set_timeout function to ensure the reload value does not exceed the hardware limit. Fixes: efa859f7d786 ("watchdog: Add Aspeed watchdog driver") Reported-by: Amithash Prasad Signed-off-by: Tao Ren Reviewed-by: Guenter Roeck --- drivers/watchdog/aspeed_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c index 7e00960651fa..507fd815d767 100644 --- a/drivers/watchdog/aspeed_wdt.c +++ b/drivers/watchdog/aspeed_wdt.c @@ -147,7 +147,7 @@ static int aspeed_wdt_set_timeout(struct watchdog_device *wdd, wdd->timeout = timeout; - actual = min(timeout, wdd->max_hw_heartbeat_ms * 1000); + actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000); writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE); writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART);