Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2691285pxj; Mon, 31 May 2021 08:21:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxinHwEBLQRGhB0GnIRG9sZ8DfQPkpZqaRiJ1XrfXUPDfQWcAYeX/EPsEJcfDDMz+vjMm1V X-Received: by 2002:a02:6d6c:: with SMTP id e44mr21014189jaf.81.1622474478536; Mon, 31 May 2021 08:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622474478; cv=none; d=google.com; s=arc-20160816; b=cl3xff6XrqFuw05Qo25+xmFzPIoDvkzHmjw2CUMXfMPK6b9tBr0KMrSPJlN5C9kEex 92ng0Dy8sc+XEaf2KPsWpKQp9G7v2uY5trggYHmHqSJK0j/jaQT478qoGo0B38vnDQn0 FqY148/SMl45poflkUUECK+hNQTUMwM5pfsDs0t3Y5afGYFSUM97SFrgemUdcwZE5fYN 9pmUyUalhzOhq2fjGaibPX07JqeOmjWlWWhHiHc+wPy27aiRPixYnUmn+yTXr9Zf7cUk PDGA4huGP7/FxXNRwKJ7fr0+DMNOkQ4KkKyc2SEpGPsvRNrxsEJieOLj2T7hjX/qK7e8 AsWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xoGNAF/I2/adU6B3769nHZ3BdyzvR0DD6Gp9OCv9lgU=; b=Gv5ZTpspybr13F4oSJ0hbYYcdPPwCOELBHM0ea6oDSYYn+stjx7IBgiorLHh1P2LJD hPXdnPqgGLPkrnM0+ukXhvw28bXdu6SHc9x3XNnLfB9nsOZYOQMPahWOpI9Xop9yHpNw ja1DM2Cy4wKwzOTVqh7n6eC9o8nwsPVqbWrFIAdLW7M1GeW8epoqIMYV6iQQa/VVv9NX jsrXaZC8yOenGfObDM5sgCnp07QZoW+iA2S4vJ/YdX/tVT1ovGGpNEadgmiZAq18b08g 3Q5Uc0e/+ctA7LbYD9/gNOmTjMhXVJl44NF0VwzcEXSvfQqpYsF/5oS0Ofl0pukOAv88 u0Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UqMPTnjH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si384751iog.32.2021.05.31.08.21.04; Mon, 31 May 2021 08:21:18 -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=@linuxfoundation.org header.s=korg header.b=UqMPTnjH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbhEaPU6 (ORCPT + 99 others); Mon, 31 May 2021 11:20:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:43310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbhEaOPk (ORCPT ); Mon, 31 May 2021 10:15:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5D2CF6147F; Mon, 31 May 2021 13:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468578; bh=wzxYdgnR4ZPdPuvp9aHArikPlC6SpJ/aN9uIQmOt+yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UqMPTnjHAEQwJNZoLVX9m12/r3dPJP3Lj4DhRVUOv4JISZilkRLMcgd9ZDsju+Yen +RD9qJWQF/1bRBdL5mKKx+mNvNvbsJuBJGeZIviTxwK7olc6KYqTiB6HiY/XYmQE8d RsWYloFflswxmL7cvHc7wH+rQLXmNje2qNcyZjlY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stankus , Jonathan Cameron , Stable@vger.kernel.org Subject: [PATCH 5.4 043/177] staging: iio: cdc: ad7746: avoid overwrite of num_channels Date: Mon, 31 May 2021 15:13:20 +0200 Message-Id: <20210531130649.405077767@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Stankus commit 04f5b9f539ce314f758d919a14dc7a669f3b7838 upstream. AD7745 devices don't have the CIN2 pins and therefore can't handle related channels. Forcing the number of AD7746 channels may lead to enabling more channels than what the hardware actually supports. Avoid num_channels being overwritten after first assignment. Signed-off-by: Lucas Stankus Fixes: 83e416f458d53 ("staging: iio: adc: Replace, rewrite ad7745 from scratch.") Signed-off-by: Jonathan Cameron Cc: Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/cdc/ad7746.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/staging/iio/cdc/ad7746.c +++ b/drivers/staging/iio/cdc/ad7746.c @@ -702,7 +702,6 @@ static int ad7746_probe(struct i2c_clien indio_dev->num_channels = ARRAY_SIZE(ad7746_channels); else indio_dev->num_channels = ARRAY_SIZE(ad7746_channels) - 2; - indio_dev->num_channels = ARRAY_SIZE(ad7746_channels); indio_dev->modes = INDIO_DIRECT_MODE; if (pdata) {