Received: by 2002:a4a:3008:0:0:0:0:0 with SMTP id q8-v6csp3625266oof; Mon, 10 Sep 2018 18:17:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaISV1bbgXtXElyRo0UMRClFKsNty5JNxx5O+rX1GkFyi7l4n9zbiAcOJjKEhuX+RFJOhU6 X-Received: by 2002:a63:6385:: with SMTP id x127-v6mr25687391pgb.413.1536628628290; Mon, 10 Sep 2018 18:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536628628; cv=none; d=google.com; s=arc-20160816; b=r1m+/Od33G1anLkwJB4bLkL8dDDxpfiq3BrsNfltLngwHEh2xg7McblWZY85OOnrfS x8LIJdgibOkAARfZNOLUnipFGHsVO3/BAgKBPJy3P3plq0JV/yO1cyYBO3X3bw54BG4I AqaKlSx/wrBl4ctr1GyD0WCFX+Y2q3ZKejsbWqtYI7tFmX889SSoTl5ZlT2AIHi0DpY0 4XlXlrngeIZLLYR27YkSG/KbnqNm2ISfGA7QgjdRbuNyjE6QiBkkQ3cwEwP2X9AfPeXf yhoefJyybJNljKinqZd8XghaJ6Y74XQgH/WZt2rz9FYr1UBH5RFIb/HBsTanlBdgoD5l /8LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=iasIj5ypgYX6XSg12OR7DRiERtbvxVb0iXjh8c2wQgc=; b=lBTokH8HzgNcYJUlzo/1AKptbAtMEWjeDFoVJzpQGrN9Ha55g6nS0kzhyKyuJ3lFPt bYeACbBqKUqVx3spfwVm7J1Bin2qGycHPvpqqdmRQo3wAV+Y+onxtuct0cB79YLqlqjG F7JkrTdUnZNAp05v1CF52FRrOtA4ey81apAmxlBTFuF3xK6QtDLFUg6D5ThB650pqyAj r5Fw4gWmcSjdx4je+YAs5rOKAVVdL2kEfsSj4AzR9OxSyq4LbqBKf/jmY4RfZiWcNNqz KdHiBRZngw+vLDB9hPx+InF8O9e09xas8LLRJI0yTfcX0/rO06jQmN0ruJv3IafV6Skj bAGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d30-v6si18453407pla.200.2018.09.10.18.16.53; Mon, 10 Sep 2018 18:17:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726423AbeIKGNb (ORCPT + 99 others); Tue, 11 Sep 2018 02:13:31 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11681 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726143AbeIKGNb (ORCPT ); Tue, 11 Sep 2018 02:13:31 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 737E86482D61; Tue, 11 Sep 2018 09:16:45 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.399.0; Tue, 11 Sep 2018 09:16:43 +0800 Message-ID: <5B97177A.6010301@huawei.com> Date: Tue, 11 Sep 2018 09:16:42 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Jonathan Cameron CC: Himanshu Jha , , , , , Subject: Re: [PATCH] iio: remove unnecessary condition judgment in am2315_trigger_handler References: <1536404256-25189-1-git-send-email-zhongjiang@huawei.com> <20180908122913.GA4445@himanshu-Vostro-3559> <20180908151751.20e7396f@archlinux> <5B967653.1030007@huawei.com> In-Reply-To: <5B967653.1030007@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/9/10 21:49, zhong jiang wrote: > On 2018/9/8 22:17, Jonathan Cameron wrote: >> On Sat, 8 Sep 2018 17:59:13 +0530 >> Himanshu Jha wrote: >> >>> On Sat, Sep 08, 2018 at 06:57:36PM +0800, zhong jiang wrote: >>>> The iterator in for_each_set_bit is never null, therefore, remove >>>> the redundant conditional judgment. >>>> >>>> Signed-off-by: zhong jiang >>>> --- >>>> drivers/iio/humidity/am2315.c | 3 +-- >>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c >>>> index 7d8669d..dc12e37 100644 >>>> --- a/drivers/iio/humidity/am2315.c >>>> +++ b/drivers/iio/humidity/am2315.c >>>> @@ -176,8 +176,7 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p) >>>> i = 0; >>>> for_each_set_bit(bit, indio_dev->active_scan_mask, >>>> indio_dev->masklength) { >>>> - data->buffer[i] = (bit ? sensor_data.temp_data : >>>> - sensor_data.hum_data); >>>> + data->buffer[i] = sensor_data.temp_data; >>> No, this seems wrong! >>> >>> We have buffer support to either take both readings(temp & humid) >>> simultaneously, or only single channel using specified scan mask. >> Key think is that bit most definitely can be 0 if the 0th bit is set. >> This isn't a null check at all. >> >> I'm curious, was this a by inspection case or did some script throw >> this one up? > Hi, Jonathan > > bit is a iterator that find the non-zero bit in indio_dev->active_scan_mask. if all bit is > zero , it should return the masklength. That's my stupid fault. The patch is totally wrong.:-( Thanks, zhong jiang > Yep. I find the issue with the help of Coccinelle. > > Thanks > zhong jiang >> Thanks, >> >> Jonathan >> >>> Patch title should be: >>> >>> "iio: humidity: am2315: .... .. " >>> >>> >>> Thanks >> . >> > > > . >