Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2809611imm; Mon, 10 Sep 2018 06:51:59 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbwcs4p02TNWjDou//nkst4f/s65iKnYSHPyWAi/d9jbkWJhJkqNKJNyCl19DkOxPbejYly X-Received: by 2002:a17:902:7e06:: with SMTP id b6-v6mr22433387plm.230.1536587519876; Mon, 10 Sep 2018 06:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536587519; cv=none; d=google.com; s=arc-20160816; b=SwaZaFVfhNeJw23MnckojCYDM3kFGZapYK8idOCalxipHn+DBgk50G1gfQiDsPSMn7 gsh3mOUez9ELENRKQqeWgtp7S1BwvpPvNghSTspWa94WGytK9b78gNldut6qJCYDsPmj bexFycpCwmNHEKt5Q1go8zgnUdBDhENIfv/nthyG14mZchvVlY+qLBrE5ZtH8paiCuBC 0fpZsjZin96povVQ1ePj6wOx+PNmpftfcssGEcXz+wKPPVBJF2h3QgypQ9L2w6JzUzpR P8BoHnxtVleq30Ru+UsuVp+7jrSeZlYV7NtV3bTY9TyiY1pOFK6uX+gidEAuDt59BvNr uwYg== 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=sWgQDwqeNFYf6UWZzvfqBCW5+yWpzCGlUsRBYr2w4hE=; b=ENC1h7ITdsGCtn6ViBH3uMpZrgfjRN9prCNbH/wQDEUA6n+tQTtyE3YadBwNWjx3qE qoL91ReWMTJPC+29PxcX6iYAU4FRTvRDzZo5I3E9I+NlvhHUSXoFUN+G9PpoeaDpfJyi 9fVd+BRMlIXRly6FLb0aAAXliwqDWyxRdYuumly801RwW5BOXfD0238xdBiPLcAFStI+ 7vQhZwMUvvp3W9/XaUXIiUJcdPbLbdYfWAVwTnxHxjktQ5b97JSAjWL0CjqtgbMRQHlu YzP+djIVX9RrAlNWFmb97wGQ+JPtQgbmgVSN8LS5jGNiaM/CzIs5N4iRUX15XyxcLHoh FeuA== 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 1-v6si16576638plk.379.2018.09.10.06.51.44; Mon, 10 Sep 2018 06:51:59 -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 S1728854AbeIJSn2 (ORCPT + 99 others); Mon, 10 Sep 2018 14:43:28 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:44735 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728110AbeIJSn2 (ORCPT ); Mon, 10 Sep 2018 14:43:28 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D91755261AC65; Mon, 10 Sep 2018 21:49:11 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Mon, 10 Sep 2018 21:49:08 +0800 Message-ID: <5B967653.1030007@huawei.com> Date: Mon, 10 Sep 2018 21:49:07 +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> In-Reply-To: <20180908151751.20e7396f@archlinux> 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/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. Yep. I find the issue with the help of Coccinelle. Thanks zhong jiang > Thanks, > > Jonathan > >> Patch title should be: >> >> "iio: humidity: am2315: .... .. " >> >> >> Thanks > > . >