Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347510

[PATCH 3.14 115/130] hwmon: (ads1015) Handle negative conversion values correctly

Path csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.14 115/130] hwmon: (ads1015) Handle negative conversion values correctly
Date Wed, 02 Mar 2016 02:40:03 +0100
Message-ID <r83VF-sE-41@gated-at.bofh.it> (permalink)
References <r82dd-7Iy-13@gated-at.bofh.it>
X-Original-To <linux-kernel@vger.kernel.org>
Dkim-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; s=mandrill; d=linuxfoundation.org; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=gregkh@linuxfoundation.org; bh=y6QZyS0esEybS90NGNHcXSTkSPU=; b=HtYS1XKKVccjzQ64ZSG7hWOWO+1pmuInIVKB7Fy/Osz1YVKsGfrWH52FuY5VyoZhMzAeqzdec+rN ITNG1rHvCq7/SgHkESGhpxgDJiFmU0clzcy+PGXiW97Xv+ubWPQ8kyJVnnj8yNQEjfi7yTrdWVqj IRHLNuv28ipxvoGx3Ho=
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1456876423; h=From : Subject : To : Cc : Message-Id : In-Reply-To : References : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=oKX7wLZri4EsZ+p2oaJLskGyNa8U0HPRo+NT/ULk71M=; b=i05zGL8SRtsg78k3Mw6vuBdj04V8Qsx13biruojwTXhHU+FPDwSHKlJYZIMHZoqtapU2BK 0jS0OpA6FK8Urr6Vh5+b8rK7EfDGVKew0wGh8vSG6ZuM1+EqQ35BFMWpOLbWnXxIG/cniQlO RXi5J8+6XVhmmjT7fyb64yZxP5uS4=
X-Mailer git-send-email 2.7.2
X-Report-Abuse Please forward a copy of this message, including all headers, to abuse@mandrill.com
X-Report-Abuse You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.6d33ef6896f04a54aba3108e9f91f596
X-Mandrill-User md_30481620
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 30
Organization linux.* mail to news gateway
X-Original-Cc Greg Kroah-Hartman <gregkh@linuxfoundation.org>, <stable@vger.kernel.org>, Peter Rosin <peda@axentia.se>, Guenter Roeck <linux@roeck-us.net>
X-Original-Date Tue, 01 Mar 2016 23:53:43 +0000
X-Original-Message-ID <20160301234503.854629158@linuxfoundation.org>
X-Original-References <20160301234459.768886030@linuxfoundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1347510

Show key headers only | View raw


3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Rosin <peda@axentia.se>

commit acc146943957d7418a6846f06e029b2c5e87e0d5 upstream.

Make the divisor signed as DIV_ROUND_CLOSEST is undefined for negative
dividends when the divisor is unsigned.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/ads1015.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hwmon/ads1015.c
+++ b/drivers/hwmon/ads1015.c
@@ -126,7 +126,7 @@ static int ads1015_reg_to_mv(struct i2c_
 	struct ads1015_data *data = i2c_get_clientdata(client);
 	unsigned int pga = data->channel_data[channel].pga;
 	int fullscale = fullscale_table[pga];
-	const unsigned mask = data->id == ads1115 ? 0x7fff : 0x7ff0;
+	const int mask = data->id == ads1115 ? 0x7fff : 0x7ff0;
 
 	return DIV_ROUND_CLOSEST(reg * fullscale, mask);
 }

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.14 115/130] hwmon: (ads1015) Handle negative conversion values correctly Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 02:40 +0100

csiph-web