Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932373AbcCBAWZ (ORCPT ); Tue, 1 Mar 2016 19:22:25 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:43800 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932324AbcCAX5u (ORCPT ); Tue, 1 Mar 2016 18:57:50 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=bHE1+LHVK6Alvhds9UXjbtFbo5JPZC+arP+YcVOT0CuXyosmIE2rZw+KyzRZtwGk/xEvFwWC1xdM M4+PHLYCikEhdrueoIZDZqzUNAy/0rUDeehQUoJj/OYwAv5JuUUIO0zBjE3TTES+j3+EIkDArwzx Hj/nrW0Jh6qJ1+EkeGk=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 259/342] hwmon: (ads1015) Handle negative conversion values correctly X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Peter Rosin , Guenter Roeck Message-Id: <20160301234536.270400431@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> 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.d91d7029a1fa460b9a76414b740b65e9 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:55:11 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1001 Lines: 30 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Rosin 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 Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- 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); }