Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3868131pxv; Mon, 19 Jul 2021 10:40:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtnAmupboLeP2oXDLT/6AtysQ8J3dc9fpjoPqWxstVHJQHzz7JqH6EPr/RZRsCVJYBC8RG X-Received: by 2002:a17:906:28d1:: with SMTP id p17mr26716580ejd.130.1626716407359; Mon, 19 Jul 2021 10:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626716407; cv=none; d=google.com; s=arc-20160816; b=gDMc+soZ6Jq7YdcggvGxO734smx9+S+dlYfkfOfsllfqMlVDyv2DfPzP4eC35cZfHK Fe6MxcsXEssd3jwyxNMNFrYcFqMWcYzsG83Re6qtltmlFQATILs3df6tK26RFF/utNDy wegWluKlLaMp8pTUf0jmZmt+gWiZNotGraFcCrJDFIvD9FkqHCSr19zLWjwy4JFiVlHd VcnKNX0lwNwC64fqfxO+7ZLlKg15zx8n5TuUai9CkV4PP5oFEtezDY270V+DSinM0fa2 jlFZBsjDqGehTZG4sD5+VcA9K2I0rKik7oObQFyUiRBkxzPzRw5/rIEdOEFykYuvg73c DkuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xzouSbL8tAgsBTE/e+ZbqZ+wFeebFgxqt+pS28/Z/gw=; b=KK1RI2aHoupHYe7rYcPS/+F89AQRrEDKVWSxqKeLc/XdcH0xRj7i9zmzM0O1Eglbe0 wCXuDnb7riiv0r2UW1IPOq8uTBpfTO6cBdY/J29Q3+3+/yf59i1R/6huSEsPiHU05Z8D xAv+ilO+fG4/bkzDso8L5vi+agyqI819GXqACQLC8txxso20lXeVX+rVHl+hCUZY40Tp Gmr2e/bsxbAcDmk0pzs8Ccz9vByvjXUfs6/fqJr5UUWHAtUbxogk2pEDXyKuDxN5CEpZ 17+YudEN39+k+6uFqfyNbgrOxDW+J3C6yD9zCkkYpdpgDS1Y0U0WC0e9hR3OhXxLQVa7 083A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QQb/uJsh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si16574485edz.364.2021.07.19.10.39.45; Mon, 19 Jul 2021 10:40:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QQb/uJsh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352279AbhGSQ5A (ORCPT + 99 others); Mon, 19 Jul 2021 12:57:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:57554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347549AbhGSPTl (ORCPT ); Mon, 19 Jul 2021 11:19:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FFCF606A5; Mon, 19 Jul 2021 15:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710304; bh=YeRPjHzK5EX/g2s1sPPjUmg37Dt96+T3QGH7KXDyeJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QQb/uJsh/h5kf0CxNJ5TvlCvZxJjWfiBTq0Rg73kM0s1aKv7lVAY3pOB/QF2xmgSH XvDrsH5R5Mr4b1kPFyhNHX7GF3elkfb+o6bsy7S3cZ9Jvc0fCTVUiePMVvV04Llwd7 qIh7tVYv+GL2+XKF53JwXEWYhYuuV0s29W5uiCEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amithash Prasad , Tao Ren , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.10 161/243] watchdog: aspeed: fix hardware timeout calculation Date: Mon, 19 Jul 2021 16:53:10 +0200 Message-Id: <20210719144946.097638229@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.904087935@linuxfoundation.org> References: <20210719144940.904087935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tao Ren [ Upstream commit e7dc481c92060f9ce872878b0b7a08c24713a7e5 ] 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 Link: https://lore.kernel.org/r/20210417034249.5978-1-rentao.bupt@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- 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); -- 2.30.2