Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4016505ioo; Wed, 25 May 2022 12:57:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi4eSqTNtcyty1FEfgeGRVW3+d9guRxBwxov9+Qam5J9zeO/zCJuhJM7BM/KX4RVFinyZ5 X-Received: by 2002:a17:906:e11:b0:6fe:8d93:1ae7 with SMTP id l17-20020a1709060e1100b006fe8d931ae7mr29546487eji.745.1653508623426; Wed, 25 May 2022 12:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653508623; cv=none; d=google.com; s=arc-20160816; b=gjbeRow4ewYDK6G6NwyN2XQVkNcOOdE56415KdP/3lhuJFiQZn2piHMdmGv4nEUtvQ 1QnOTuogvVag5MoMDn10JKLq2w1FIoy5bFR5Oofoied7GKHjsgX3m5fN+Z6Bsu6RGtFn izY6v6ZcFdn079YQ4Q+GatEN8SWT0962IbJbGmYzjQPRVIMa/Da1r6zmNqBeqLRVU+Gl i+FWJyk7t4Sgv2j/vkE0r0dXxRJXm2yyuYJoVYCDVutZPNNUfiQUhPM0f60RRZy5p0Ow JrlL/XJ8HXd6x+8Pjh2KVkNIKeHGq/G1Y4iskYYztzqs+YpZHWYqV7pGF99Y5nilkJeO tArw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=FFUK7D8XCPXBu0//LWjFhArsz1IDRveWhBgP1ftx7Sg=; b=qHt+YV3wgrzAqKYEZq7lK7pfivhLY/6o4thVXLEIRRFTUaBDnXQhskkKfq6v2wSf+x WHAWLQkfFfvpKJ6Tdk/aEWm/VwSajS93NeXFSZVakCLhfac7H6+uz4YiyRy7m44Ij5A6 rGs5LVa/QV1HY/McWDZZg/TN/Yk6zDeYPRYu1Y/O3JxTADoEAeWPvJz2O4hR50YoQeJM 9tsi7mMCVK3I9cGUzlHtcFdAM7jZSpas/ccNlhCyhJBaq4+TY1ucXRw+6RLl3l0BFONV t/VQKegzmqcMJvvY88vZ4oaAEXlDUEuhnhAbhCdlbmf6M5smJPBGeFSrvY2sdQ5gdClO h45A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a05640226c900b0042b4bd72e84si14978862edd.22.2022.05.25.12.56.36; Wed, 25 May 2022 12:57:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244145AbiEYGeJ (ORCPT + 99 others); Wed, 25 May 2022 02:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244135AbiEYGeH (ORCPT ); Wed, 25 May 2022 02:34:07 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEFD24EA13; Tue, 24 May 2022 23:34:05 -0700 (PDT) Received: from localhost ([31.220.118.249]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N0FE1-1nfX7s1UE3-00xNHI; Wed, 25 May 2022 08:33:39 +0200 Date: Wed, 25 May 2022 08:33:38 +0200 From: Andreas Klinger To: Li Zhengyu Cc: jic23@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: srf08: Remove redundant if statement Message-ID: References: <20220523122755.90638-1-lizhengyu3@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220523122755.90638-1-lizhengyu3@huawei.com> X-Provags-ID: V03:K1:WuCXsISV+LcR2fiPYceeJ/1veCe1id+9u8nVSBSHAaEPTL1EMfD /HdLCkq1VkRj6PAc3I7PdNOlqhg8av/+vc4icCrIsjRb2rzcgEDOah1UHgl5APpDftlU849 e7vK+JdOK4qAj7pWFYxqvaxAcnm9h5X8lIClQD9ImeC2GSbdJqsbXKduJigPMTIQcTC5Hpg sQfwvUPOcKJXzMMPUCQyw== X-UI-Out-Filterresults: notjunk:1;V03:K0:/5SOd4ZNpR4=:bpPXgQM6zMLYq/zKz9NmA/ VkabMv9XhdOQslnElnrZn8GJ/1q4+84tbGPumWSEj7Ql806RI7InR4MWQrd/ZA8FsACXFyw+9 /tKNscZCOD87R3KE/TwY41PpZFC3yhEVEH6a5PNDsD0z/Qg7/o656TsT03e8c4CIT3h9qDip7 V//B9wWAGilx3UzmyjwvMJ5qek0Q6UXfS+dEoGlSRW/tln3Sny4RcFhddAXKnLnNg8BeHHtDJ wn4D2HxHHDL7llBlXkBynl3EX5jECMJgbR7fk3iUVaUnlePUvknG9QQCG+9n396PM/Zrp7JUH hL/nEK34IkQe1yb562X5pebpUUy7NjuR6GQZcOcHoVm36VHDjTIQzNOSNmv9ObEcO1jqBkhDK Pf0i40mctf4SKfQJfQqdY7NJo6h0SGe5SveOM91/yLPaRX9+YpQpp1JzXUfx/gJJokDvS24Pb e4TSY8u/s6MsLJESIXacg6I2wD4pDjLwgxV0cP3DVNhfIVtTgpVvqXr72wO+9N/0Mr8eLHBUG GsNUynfggNp0Jwx9VfoQODPPrqom4UifpJ+2KEGBUcb8gCQy8oQQwz0fysBopEe2UtP8Sx2rR yotz7TtX4uvx1RCHOJZD5nx6LpHnBODNCWNdm27NmaCH1B01r3mQGwEaVv48VnJ3mQv51ozbT MtUBoqB8EMV2pCg0noTeUH3wwPiJKYoPAEPKMKCqtMqYdyP2KR+sX0ZNlX8AcqWDNUi0Mq/QD 8gDvdMpAHmfzbbBX+zKVm3Lp+ELVtMKvAa+unQ== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Andreas Klinger Li Zhengyu schrieb am Mo, 23. Mai 20:27: > (!val) has been checked outside the loop, remove redundant (val &&) > from loop. > > Signed-off-by: Li Zhengyu > --- > drivers/iio/proximity/srf08.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c > index ac1ab7e89d4e..7ed11339c31e 100644 > --- a/drivers/iio/proximity/srf08.c > +++ b/drivers/iio/proximity/srf08.c > @@ -354,7 +354,7 @@ static ssize_t srf08_write_sensitivity(struct srf08_data *data, > return -EINVAL; > > for (i = 0; i < data->chip_info->num_sensitivity_avail; i++) > - if (val && (val == data->chip_info->sensitivity_avail[i])) { > + if (val == data->chip_info->sensitivity_avail[i]) { > regval = i; > break; > } > -- > 2.17.1 > -- Andreas Klinger Grabenreith 27 84508 Burgkirchen +49 8623 919966 ak@it-klinger.de www.it-klinger.de www.grabenreith.de