Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp700210imm; Sat, 8 Sep 2018 07:19:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZTU5MP6Uw+p+0bTbJ3IZMO4SZwG/9G/Gnf+kaquHxYLtdZX6/TWjxJ8VvIWUU9akywioaY X-Received: by 2002:a17:902:a58c:: with SMTP id az12-v6mr13040802plb.339.1536416360167; Sat, 08 Sep 2018 07:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536416360; cv=none; d=google.com; s=arc-20160816; b=hjwqdZSmoG4fg5uG2WY7qcDcebff6iVNobEbli0WMh4HGeMZUQ897Rh0W5UdacfEGm 7Il3jIASSf6xfizmMLQR0X+UVbFtwfqYEVDSlb9EmTUv2qiQn9Xm/U/M3C7dVc2Yzs/o Y9AnteCgIbQ4/JuzTdqzt4Q6FmsvjK87rTTWj5lfPgtcnp9XvNpzQGk1gVDL/PjvdDLJ Qmkf8hgklntnhpuC1pz2y5CLmLLbY90ilK4RGQLUI5Rj+e9vVpqBYlZ22KmZoXqwav25 shhlEUsAmP4xdr1y+Db/DtP4MBUOLRK4pHEEPZqdCkN4pajj3r8D0o+f2PtrDD2cnsJl lRvQ== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=96+UmpOLezOYj/wF6racEGonfLv2Vg0cSJwkxSINXN8=; b=qDXNDHd1qEdJowiPM1Qxr1LqU7WZm3O5lf4NIqzgdpeM3ZMDs3iBIrsedptLRvNWvb CZ4jhGRCVK8256ZZ0TtkDKzaKbwNF0F/voWHVSrUBrb6E6QLY1kBB78hNHwwVLug4SxK v1B09TExRd5GDP4S2ad9qyMPJ7eeTfB9OEWEkpT3JPWQJ7ZOFoHu3A5snsyt1MfoXPRi mxLjc23fOd9nQz3GzzWwvJhH++siJpCyJK9wmnOSouJITkUoSkEYqLA1iSRn3CUipdT5 DDtqEtPDIcBXy8SFR5MHmj3j3pCzKAWaS7l/qxA7IhatUCkM2H3Ne1uDzVjbK5w+xOaw HP/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dnEuKC6I; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24-v6si10572533plq.358.2018.09.08.07.19.04; Sat, 08 Sep 2018 07:19:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=dnEuKC6I; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbeIHTDx (ORCPT + 99 others); Sat, 8 Sep 2018 15:03:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:50192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbeIHTDx (ORCPT ); Sat, 8 Sep 2018 15:03:53 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 36C892075A; Sat, 8 Sep 2018 14:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536416275; bh=3roJy3z0QfwO7aEy7+p6OrGdKeho++slnZ7cSqge9UI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dnEuKC6II9u/4SvikCxjn2mtZTAkn27pMqqWfqVNAKFTApAZtXigtABms0pNlfBYU yDsVRrnIFiasxhFXO2il9SzkGOa2xQBPGkjMpt0bJK5f0iCCGVbUCqto0Sg4fG+i/Q WycpLQTk4zgjj9TI+6sz1jmZ+Jl9glHZ+bhsGZB4= Date: Sat, 8 Sep 2018 15:17:51 +0100 From: Jonathan Cameron To: Himanshu Jha Cc: zhong jiang , knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: remove unnecessary condition judgment in am2315_trigger_handler Message-ID: <20180908151751.20e7396f@archlinux> In-Reply-To: <20180908122913.GA4445@himanshu-Vostro-3559> References: <1536404256-25189-1-git-send-email-zhongjiang@huawei.com> <20180908122913.GA4445@himanshu-Vostro-3559> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, Jonathan > > Patch title should be: > > "iio: humidity: am2315: .... .. " > > > Thanks