Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3228090pxb; Tue, 20 Apr 2021 03:40:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+Acw4awHX71didfZeRpkSvqjBWI5GaZZP6T1uobpj7kl+SftsoJ97ir/cyH5fOyJNg+2I X-Received: by 2002:aa7:ce91:: with SMTP id y17mr24197517edv.13.1618915209173; Tue, 20 Apr 2021 03:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618915209; cv=none; d=google.com; s=arc-20160816; b=htqqwJUb3D2z281HykB3gpPFZVj3futotS7gE9j1FUbZ/PqAG9lIvR+g23ex+40XnR zbivXD7PjNkEZulVyiLwwaA0oI1J8K5GtMppw5ALrIu1NA/V49BVFJTWolVuePI/SmMc mbGR/g3meJh/vXTmf06gst9RpS5zUpQa0FRiMjoF69rScmdY1RZxL91P/rsMG3ptFCmD sxJiEmU/8d/fZGCIrlgDN9o+0AxeRsRcVdMS/+JDROIZOLPRvUuQot7wWxMLqMdePA8z TcsZwd+rZnBjPYzejdrm0Swvqz8YhPKSR45xTzo2lJqnXAppul+Abhov0RnGmMDe47dV PwFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=0XEP9/H3iXNzVGTI2M1Xl1bpsOBMjeC6e3/KXOWQS04=; b=BsfvKYGqu9/ETQAKT1vs4cMViTHzVPXR0Y3GzjN0OYJfE6Wxb47dBI5fceoQrLxbKu X4zSu0UVrzLRmzbZP7UJm01gQhHzjcD0SktxxXKzXIh7fdyYKvjOKS9csJ3ha9zhvzyI NYAEKMmzbLWCyEtas/HPZgukceqjoxpWdl7xbwcCLdZoY+Tm9uf9+tFfJ2uMgiieWjGe fW74aYapXu901gSzInlyw5/4tM0mLvRdsFiyLG81v6qBDzEVrdSFpJaO2SJcMoS1DY7B 1iNqXVXcFf24GBP4PqI3F67+ckOnOSUiLDYASwckYoLCm9dWW07vX5au/18LIq8k8rQX 1z7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si11521383edv.515.2021.04.20.03.39.45; Tue, 20 Apr 2021 03:40:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231615AbhDTKhI convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Apr 2021 06:37:08 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:30226 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231388AbhDTKhH (ORCPT ); Tue, 20 Apr 2021 06:37:07 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-191-YHdEDlu2P2KuNLjymnM4BQ-1; Tue, 20 Apr 2021 11:36:32 +0100 X-MC-Unique: YHdEDlu2P2KuNLjymnM4BQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 20 Apr 2021 11:36:32 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.015; Tue, 20 Apr 2021 11:36:32 +0100 From: David Laight To: 'Dan Carpenter' CC: 'Mauro Carvalho Chehab' , Ashish Kalra , "devel@driverdev.osuosl.org" , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , Sakari Ailus , "linux-media@vger.kernel.org" Subject: RE: [PATCH] media: atomisp: silence "dubious: !x | !y" warning Thread-Topic: [PATCH] media: atomisp: silence "dubious: !x | !y" warning Thread-Index: AQHXM7teiyJWcTifxUyFg0sAh0Hgi6q5OhAggAPtUoCAABHiYA== Date: Tue, 20 Apr 2021 10:36:32 +0000 Message-ID: References: <20210417153627.GA50228@ashish-NUC8i5BEH> <20210417205613.5c1aac74@coco.lan> <509f019decae433cab6cb367cdfa6fa9@AcuMS.aculab.com> <20210420102747.GB1981@kadam> In-Reply-To: <20210420102747.GB1981@kadam> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter > Sent: 20 April 2021 11:28 > > On Sat, Apr 17, 2021 at 09:31:32PM +0000, David Laight wrote: > > From: Mauro Carvalho Chehab > > > Sent: 17 April 2021 19:56 > > > > > > Em Sat, 17 Apr 2021 21:06:27 +0530 > > > Ashish Kalra escreveu: > > > > > > > Upon running sparse, "warning: dubious: !x | !y" is brought to notice > > > > for this file. Logical and bitwise OR are basically the same in this > > > > context so it doesn't cause a runtime bug. But let's change it to > > > > logical OR to make it cleaner and silence the Sparse warning. > > > > The old code is very likely to by slightly more efficient. > > > > It may not matter here, but it might in a really hot path. > > > > Since !x | !y and !x || !y always have the same value > > why is sparse complaining at all. > > > > Smatch doesn't warn about | vs || if both sides are true/false. But > I've occasionally asked people if they were trying to do a fast path > optimization but it's always just a typo. The problem is with people blindly patching code to 'fix' these warnings. It might just be a fast path optimisation - which they break. Trying to beat the compiler into submission can be hard though. Getting it to 'or' together the outputs from a series of x86 'setne' instructions isn't for the faint hearted. Not helped by the instruction only setting %al. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)