Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp669106ybg; Mon, 1 Jun 2020 11:13:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3t/cvMbGnGZBCw2p20o+kJJcWumM8HzH5YbnIQ1nXJZSZnjyCm0mmZoIJQ9r7I2Wf5e8P X-Received: by 2002:a17:906:b817:: with SMTP id dv23mr20080167ejb.185.1591035220135; Mon, 01 Jun 2020 11:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035220; cv=none; d=google.com; s=arc-20160816; b=YZOulkp+2Hqi51WOSWWfZxlzRS7L68sVN9JT+aAgcKduT1my3LAQ38NYJT+yfxwZWf LfKdFGM4HAvZPa4e3ApBLwMBcs7r5IfiwWYS+Kwe0PSFRp5o6LinJq62GK0cdwVtcYor qNolJcvqocL+BmgHzds8eSJv36qutuKDGC5qUOiQucxawaXkY/ODxYInmWj1Tj2bWhNH rsOCrh30ggcnSYJxfkNGpc6drUfTAzvQOo8SoOrsDlTksmfdzISFSDX5XeEd6CcVL1aQ S9SVCiubP905I6Q9UvZvzj8KfMQuotzrPXuzd3jnpytt8eMn4cQdhxC+JfvOGLjuvpk8 EVKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RB7jVMtd3PXHpNSmhetDElcjByMVrV+Zkgm9u+K+mcE=; b=EuKvoVR+0c1AOZbVf7o1OuezxRYl5IhQczVWR0KRwoTbp/+69yIxtB1GezIl1TijLc HpWvCkDZ91ZBSyD6WPcs+K+XuSyk67ZtRtcw6ga7MxvWFd6oxexOyBQUIx1OhMwtxnGq GN/pq1tlxqcKV5JgtEBrYpKEiC3DKE8KJBHcyDzqLdneQknvdlg7cG9PhbHn6PfTntS0 uZjn7x4iRP63byqlkKMk61lwL7A98rZy+U8ApzmGhC5tKynkwyxHMCYFKljN3OHePFAT zH00FldwIFGDQ3ev3uUNVihAiKSacTNIqqlhgM62c5A4JfbHzreNMPAbXZYsI3ptyePE fwQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CHvPhv8L; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp9si124573ejc.698.2020.06.01.11.13.16; Mon, 01 Jun 2020 11:13:40 -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=@kernel.org header.s=default header.b=CHvPhv8L; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730716AbgFASIU (ORCPT + 99 others); Mon, 1 Jun 2020 14:08:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:54352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730241AbgFASIP (ORCPT ); Mon, 1 Jun 2020 14:08:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B3BA207D0; Mon, 1 Jun 2020 18:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034894; bh=hu3+Cu1mobOMU0osGTqGMIyMafxT7FTy0kESiJ1M/lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CHvPhv8LQc1JnRZdSmvCzPDFJsDhbZ6Tijf3cY7WrckPgyZUR+UcfubNoKUHziQZn gypFLxwzJlR+5rkf8QMGj5ADRMELRy6y5ep8iupzKmrwGkpt0pKy1BL4Pm0wNM61Y+ Od3aBOBSu/4VwfvH7Dwc5jKBMCNw9+Tv6boUkI/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amy Shih , Guenter Roeck , Sasha Levin Subject: [PATCH 5.4 058/142] hwmon: (nct7904) Fix incorrect range of temperature limit registers Date: Mon, 1 Jun 2020 19:53:36 +0200 Message-Id: <20200601174043.933164252@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amy Shih [ Upstream commit 7b2fd270af27edaf02acb41a7babe805a9441914 ] The format of temperature limitation registers are 8-bit 2's complement and the range is -128~127. Converts the reading value to signed char to fix the incorrect range of temperature limitation registers. Signed-off-by: Amy Shih Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/nct7904.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c index 281c81edabc6..dfb122b5e1b7 100644 --- a/drivers/hwmon/nct7904.c +++ b/drivers/hwmon/nct7904.c @@ -356,6 +356,7 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel, struct nct7904_data *data = dev_get_drvdata(dev); int ret, temp; unsigned int reg1, reg2, reg3; + s8 temps; switch (attr) { case hwmon_temp_input: @@ -461,7 +462,8 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel, if (ret < 0) return ret; - *val = ret * 1000; + temps = ret; + *val = temps * 1000; return 0; } -- 2.25.1