Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2228448pxb; Fri, 17 Sep 2021 05:22:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPng+yHGn9JDdjoEdu4TWr5wD6/pH0AWGcF42bOWzZFQ6s31mxDzS0WM8C0cefYhorN7z5 X-Received: by 2002:a17:906:dbe3:: with SMTP id yd3mr11593556ejb.90.1631881344685; Fri, 17 Sep 2021 05:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631881344; cv=none; d=google.com; s=arc-20160816; b=LRAraGvqKL2W7F0LyS/RrnTeXEMSdboF4cX2OGIUlBclV8v4OufHlL1BuDlKlyUAY1 jdQPpR9aSKQ9Y/xppwrAewizLWXIb2AZdoYk2cpEUuGUQOVJnaTlKBBjcSXnSC9EHcBO rKrxMu7tNFYHeYfyYrwVRYob/ApYOd+zfprzhdcCrqwaosWs57xtyjVnQE7CUuZCZJbi VOU7D6YYEP078pSP2b0FD3z5kRcXXJ4SXDKrurAcPzJikzyckpJ3t+F2F+EwWTDeizpF rF0h8V4JcYp/RvCriTilddssa9ji0HM39c4B2s2W7XeYZW92urMCcZmgez1x5MgMrjtK Khvg== 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=FSbmeLC/6EiGcWADoaomrJkrwq3g9r/uV3hVFDdibdk=; b=nvxSExUJWSBNvK+jEMH4vLKtwsOPESom01JTMYDZ5M3A5KpX+iShdBXWIVM9OHf2ig e32q+BRc780QyZh0A/qzOZlSqZZtx/2Ff9yOf22FkQrhmQkupZCwg2mHl5i5Nms9oQkJ CdVjkayjSEykkze7CHa1ipTZsBRI4THAKcphYbNq0AG/Tv/dEhFdngBhZWXOv8b109IG mZFZLfbyddXIIntfig6F2IUP9PYVhGs36dd1lblIsQxKKLn+gV4UZyoXSILHF5dCpr52 vLhG2qgChXbk191ZIMQdxcDJ0EsshKFpXi2seb9zYB4wYZ41WLPr49ywfWJWAVdgIdZV ohww== 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si6519072edt.384.2021.09.17.05.21.59; Fri, 17 Sep 2021 05:22:24 -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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244635AbhIQEa5 (ORCPT + 99 others); Fri, 17 Sep 2021 00:30:57 -0400 Received: from smtp1.emailarray.com ([65.39.216.14]:43434 "EHLO smtp1.emailarray.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244346AbhIQEa5 (ORCPT ); Fri, 17 Sep 2021 00:30:57 -0400 Received: (qmail 3104 invoked by uid 89); 17 Sep 2021 04:29:35 -0000 Received: from unknown (HELO localhost) (amxlbW9uQGZsdWdzdmFtcC5jb21AMTYzLjExNC4xMzIuMQ==) (POLARISLOCAL) by smtp1.emailarray.com with SMTP; 17 Sep 2021 04:29:35 -0000 Date: Thu, 16 Sep 2021 21:29:33 -0700 From: Jonathan Lemon To: Nathan Chancellor Cc: Richard Cochran , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] ptp: ocp: Avoid operator precedence warning in ptp_ocp_summary_show() Message-ID: <20210917042933.d42m5ijbiiqrctxp@bsd-mbp.dhcp.thefacebook.com> References: <20210916194351.3860836-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210916194351.3860836-1-nathan@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 12:43:51PM -0700, Nathan Chancellor wrote: > Clang warns twice: > > drivers/ptp/ptp_ocp.c:2065:16: error: operator '?:' has lower precedence > than '&'; '&' will be evaluated first > [-Werror,-Wbitwise-conditional-parentheses] > on & map ? " ON" : "OFF", src); > ~~~~~~~~ ^ > drivers/ptp/ptp_ocp.c:2065:16: note: place parentheses around the '&' > expression to silence this warning > on & map ? " ON" : "OFF", src); > ^ > ( ) > drivers/ptp/ptp_ocp.c:2065:16: note: place parentheses around the '?:' > expression to evaluate it first > on & map ? " ON" : "OFF", src); > ^ > > It is clearly intentional that the bitwise operation be done before the > ternary operation so add the parentheses as it suggests to fix the > warning. Actually, the correct fix is to change '&' to '&&', so a logical operation is done instead of an arithmetic operation. I believe this will silence the warning from clang. -- Jonathan