Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752447AbdIXNJ0 (ORCPT ); Sun, 24 Sep 2017 09:09:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:48604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbdIXNJY (ORCPT ); Sun, 24 Sep 2017 09:09:24 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2245F20C51 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sun, 24 Sep 2017 14:09:19 +0100 From: Jonathan Cameron To: Fabrice Gasnier Cc: , , , , , , , , , Subject: Re: [PATCH] iio: adc: stm32: fix bad error check on max_channels Message-ID: <20170924140919.669c9cca@archlinux> In-Reply-To: <1505751855-15490-1-git-send-email-fabrice.gasnier@st.com> References: <1505751855-15490-1-git-send-email-fabrice.gasnier@st.com> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1042 Lines: 30 On Mon, 18 Sep 2017 18:24:15 +0200 Fabrice Gasnier wrote: > Fix a bad error check when counting 'st,adc-channels' array elements. > This is seen when all channels are in use simultaneously. > > Signed-off-by: Fabrice Gasnier Applied to fixes-togreg-post-rc1, fixes tag added and marked for stable. Jonathan > --- > drivers/iio/adc/stm32-adc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c > index e3c15f8..4df32cf 100644 > --- a/drivers/iio/adc/stm32-adc.c > +++ b/drivers/iio/adc/stm32-adc.c > @@ -1666,7 +1666,7 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev) > > num_channels = of_property_count_u32_elems(node, "st,adc-channels"); > if (num_channels < 0 || > - num_channels >= adc_info->max_channels) { > + num_channels > adc_info->max_channels) { > dev_err(&indio_dev->dev, "Bad st,adc-channels?\n"); > return num_channels < 0 ? num_channels : -EINVAL; > }