Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753478AbdCPOwA (ORCPT ); Thu, 16 Mar 2017 10:52:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60802 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753061AbdCPOer (ORCPT ); Thu, 16 Mar 2017 10:34:47 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Breathitt Gray , Jonathan Cameron Subject: [PATCH 4.10 01/48] iio: 104-quad-8: Fix off-by-one error when addressing flag register Date: Thu, 16 Mar 2017 23:29:45 +0900 Message-Id: <20170316142920.839442776@linuxfoundation.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170316142920.761502205@linuxfoundation.org> References: <20170316142920.761502205@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1070 Lines: 33 4.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: William Breathitt Gray commit ca8d8e03b4c9ad447d1e882cc8014e538f653018 upstream. The flag register is offset by 1 from the respective channel data register. This patch fixes an off-by-one error when attempting to read a channel flag register where the base address was not properly offset. Fixes: 28e5d3bb0325 ("iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8") Signed-off-by: William Breathitt Gray Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/counter/104-quad-8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/counter/104-quad-8.c +++ b/drivers/iio/counter/104-quad-8.c @@ -76,7 +76,7 @@ static int quad8_read_raw(struct iio_dev return IIO_VAL_INT; } - flags = inb(base_offset); + flags = inb(base_offset + 1); borrow = flags & BIT(0); carry = !!(flags & BIT(1));