From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76BDE70 for ; Tue, 18 May 2021 00:55:57 +0000 (UTC) Received: by mail-ot1-f50.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so7217736otg.2 for ; Mon, 17 May 2021 17:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yucLhkWF+a1ME5Qb9j9m9s8qqNJAVcLcCSl2OC45snE=; b=a1KtrMinmN+R1YtVythdwnFkHS+Tdbgcmy9l7vSOkqxC/vVzx3wsPHDcDj0DG+1l2/ RAbz/FiBBFOjwDrtjtYHY7181fS0TDnX/yv85f7YxllwE/6X1eKZp22timlc9ZYCAZpo TF/QlZ3Eyyp6fVaUIbgfXYalF67Do2Yc3RLE40lf+4qfiALN1jJ22SMRVlKlsV0x6Qsl VtUIP1xQle5akujtsLkyGB8lA20n81jCSRIT+DuB9XSVPpPhuk8N0j/rXwzJEVn9cOQn 1pNrxzGbdOfiIlBlBZSopbArR3+M48OmHTD47uPPg+7xoLyLuwhmIbzIAPQW+v6xRY7k ipRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yucLhkWF+a1ME5Qb9j9m9s8qqNJAVcLcCSl2OC45snE=; b=nGyfhvP8AWmU19RdyNJZsHjbQX5lzcdWHruDkHaM+wtt5GteIht54Bz9sipWVf6BtH 9kA2Sg3a24WA9mGG0OF7pZQ2XF7MIHtgndB/w2XILasTnBczoo8W+3hom5KpX6y+MY+L DhWNMAOweV0CQzFWum+ad1pGPVGcDMYarTMTf/qlcvOt7AA00vCkWpDNpBYX6Jlo53c1 2MXxubUxF8bh14Ymc3T3x5neEgs1fo7RV36ewRMih1R/Gl5nFg7pVQcF9/b5kOvxKht9 QS04ix08UnGYNIaSYZIDXWk2lszL43Kzkie6XSNDooBiYzP4LUJ99NX7by392HvpLZUN 2ruQ== X-Gm-Message-State: AOAM532XVia2quNf26cukyCazMu8GZv7jEepiTwNxMjrveZSFGtALP8k 28xMijom64QICkF0MxQsSchl0aJJAEg1Prv96Ds= X-Google-Smtp-Source: ABdhPJwuJ0+nGKTuihXix656KLbhr2kT8htvpkRAwuHkWBDuRxzKK2bQGjz+fNsbob/VoKSe9F7HsrIUJTbcT2S43K8= X-Received: by 2002:a05:6830:15d2:: with SMTP id j18mr1995944otr.89.1621299356430; Mon, 17 May 2021 17:55:56 -0700 (PDT) X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <09e65d3a235febfc4c3ee172b573ba8c9cde94b8.1620766020.git.lucas.p.stankus@gmail.com> In-Reply-To: From: Lucas Stankus Date: Mon, 17 May 2021 21:55:20 -0300 Message-ID: Subject: Re: [PATCH 2/2] staging: iio: cdc: ad7746: avoid overwrite of num_channels To: Alexandru Ardelean Cc: Lars-Peter Clausen , "Hennerich, Michael" , Jonathan Cameron , Greg Kroah-Hartman , linux-iio , linux-staging@lists.linux.dev, LKML Content-Type: text/plain; charset="UTF-8" On Wed, May 12, 2021 at 2:20 PM Alexandru Ardelean wrote: > > On Tue, May 11, 2021 at 11:55 PM Lucas Stankus > wrote: > > > > 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 > > --- > > drivers/staging/iio/cdc/ad7746.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c > > index e03d010b2f4c..9e0da43b2871 100644 > > --- a/drivers/staging/iio/cdc/ad7746.c > > +++ b/drivers/staging/iio/cdc/ad7746.c > > @@ -693,7 +693,6 @@ static int ad7746_probe(struct i2c_client *client, > > 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); > > ohh; good catch > > this falls into the category of a fix, so a Fixes tag is required; > this looks so old, that i did not bother tracking it before > 83e416f458d53 [which is 2011] As Jonathan said, this bug was already fixed and the patch will be dropped, but thank you for the review. This was my first bug fix in the kernel, so sorry for the absence of a Fixes tag, I'll make sure to add one next time. > > so, maybe something like: > > Fixes: 83e416f458d53 ("staging: iio: adc: Replace, rewrite ad7745 from > scratch.") > > > indio_dev->modes = INDIO_DIRECT_MODE; > > > > if (pdata) { > > -- > > 2.31.1 > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DF2AC433B4 for ; Tue, 18 May 2021 00:55:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62D7D6139A for ; Tue, 18 May 2021 00:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345257AbhERA5P (ORCPT ); Mon, 17 May 2021 20:57:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238397AbhERA5O (ORCPT ); Mon, 17 May 2021 20:57:14 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51640C061756; Mon, 17 May 2021 17:55:57 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id t4-20020a05683014c4b02902ed26dd7a60so7211171otq.7; Mon, 17 May 2021 17:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yucLhkWF+a1ME5Qb9j9m9s8qqNJAVcLcCSl2OC45snE=; b=a1KtrMinmN+R1YtVythdwnFkHS+Tdbgcmy9l7vSOkqxC/vVzx3wsPHDcDj0DG+1l2/ RAbz/FiBBFOjwDrtjtYHY7181fS0TDnX/yv85f7YxllwE/6X1eKZp22timlc9ZYCAZpo TF/QlZ3Eyyp6fVaUIbgfXYalF67Do2Yc3RLE40lf+4qfiALN1jJ22SMRVlKlsV0x6Qsl VtUIP1xQle5akujtsLkyGB8lA20n81jCSRIT+DuB9XSVPpPhuk8N0j/rXwzJEVn9cOQn 1pNrxzGbdOfiIlBlBZSopbArR3+M48OmHTD47uPPg+7xoLyLuwhmIbzIAPQW+v6xRY7k ipRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yucLhkWF+a1ME5Qb9j9m9s8qqNJAVcLcCSl2OC45snE=; b=dkh0Vq5/Y7GzkcmlxVwi7z1Iu0FXzxhLZvSDDt3/8Jn7DSoIM9HaAxjawZPuLgRYT0 vxwzFv454gVjiHMSnSKH5iDohmUkORtcME+N4mJC/Bk/TpxJ/xlt92wHmzkgFE+ALNly GPDI3oHFP6hlWWDot++8N+YddSVBgBmrmXql8OS+wcWzjT6260wT/9lZLIHKYOHjevlz CKXDd2rbk97uPIjd6Vt467atwDKFRl8pImrvcyWd+PZyiE5DfH/yGIQHuaoNyyH9HTn+ YhMVmtw7YyDHfQES2IAceFK4zcPN2AgP28ANolSNdH//LTMjKfHf0gbQ1XYzIjfNHee4 VRzQ== X-Gm-Message-State: AOAM532qdhuXf1uHT4ZUxu7t7LYE23+VLW5A23Zxlsg5hzG52D6IhPdG DxcOB9IT6Q4SN2K6y5r2Y0RLMeDnhEAPZCklAgY= X-Google-Smtp-Source: ABdhPJwuJ0+nGKTuihXix656KLbhr2kT8htvpkRAwuHkWBDuRxzKK2bQGjz+fNsbob/VoKSe9F7HsrIUJTbcT2S43K8= X-Received: by 2002:a05:6830:15d2:: with SMTP id j18mr1995944otr.89.1621299356430; Mon, 17 May 2021 17:55:56 -0700 (PDT) MIME-Version: 1.0 References: <09e65d3a235febfc4c3ee172b573ba8c9cde94b8.1620766020.git.lucas.p.stankus@gmail.com> In-Reply-To: From: Lucas Stankus Date: Mon, 17 May 2021 21:55:20 -0300 Message-ID: Subject: Re: [PATCH 2/2] staging: iio: cdc: ad7746: avoid overwrite of num_channels To: Alexandru Ardelean Cc: Lars-Peter Clausen , "Hennerich, Michael" , Jonathan Cameron , Greg Kroah-Hartman , linux-iio , linux-staging@lists.linux.dev, LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 2:20 PM Alexandru Ardelean wrote: > > On Tue, May 11, 2021 at 11:55 PM Lucas Stankus > wrote: > > > > 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 > > --- > > drivers/staging/iio/cdc/ad7746.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c > > index e03d010b2f4c..9e0da43b2871 100644 > > --- a/drivers/staging/iio/cdc/ad7746.c > > +++ b/drivers/staging/iio/cdc/ad7746.c > > @@ -693,7 +693,6 @@ static int ad7746_probe(struct i2c_client *client, > > 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); > > ohh; good catch > > this falls into the category of a fix, so a Fixes tag is required; > this looks so old, that i did not bother tracking it before > 83e416f458d53 [which is 2011] As Jonathan said, this bug was already fixed and the patch will be dropped, but thank you for the review. This was my first bug fix in the kernel, so sorry for the absence of a Fixes tag, I'll make sure to add one next time. > > so, maybe something like: > > Fixes: 83e416f458d53 ("staging: iio: adc: Replace, rewrite ad7745 from > scratch.") > > > indio_dev->modes = INDIO_DIRECT_MODE; > > > > if (pdata) { > > -- > > 2.31.1 > >