Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3352252pxb; Mon, 18 Oct 2021 13:25:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLeMHcS/ePbYM9JVCrWhEyiBu4Y+yhO9NXiAyxOd3b3M7egNQF+NfKG5OlC0WP/GZtzhDo X-Received: by 2002:a63:7a4a:: with SMTP id j10mr24755433pgn.284.1634588727880; Mon, 18 Oct 2021 13:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634588727; cv=none; d=google.com; s=arc-20160816; b=iLE56L4/2tziaYmfb6viQxNDuHJQticeDFKokWC+xRFckahzBZcurEnpCYSHeirnpr 8L36jhtDbJHo7H2BhwAUrjTWp/3UIie4/zobUF8XaTNlF0eVerkew+gu7smEQu0CkK1q aC7NCqTec6nCR6ZKsIqQG+5HmQzP+yFRx31QAoHGL3P7Xb+OO2amJa3Gpnq7XqokBczV qepzQERTOlSg5FByxxZzqk7cjq95KKdJ17+L2OH32OL3e/6N2YBbKeR1p4ddRh0cEFfZ MDYByu27rL/oHFp2Mu9RuK8riKKc3FYb1V3zCgcrdfvjGAnrZBOmF/9XLemTJVX4yFa3 Ud6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hShfojEUzBmMpgkHo84N+Rx+m8nkMxhA7mhDB+mvFaE=; b=AljbVc5KACZN2IUYlpGs8USZdY8vGZ8oIgx2eY/Jd+kXYW7K/3N0EBuLZBfc84DItO iJP+qe6TX6qy/6NotJnDN1itGFqxtjAr7Q8CE4q4HnjruTs53F4BAVmH+E4CRlO0PliU sbYXPeHIzac7Kfb0MZcfIJRosFXDDfuTt4S6yc2XS35APTRYu8RiA3CmTMfER/sHuYJ1 GKq/RbhAFuu4Y0niZ6CBXsZP8gI+fvaUHsx49Ik0rvpuAZe5z2c9UXyFCLjYoeQtmCQ9 JS3GY2P1+Wr/cQgCkmVvREIrptv5RUuJY0VeDQ/mKC0/cxRuH42KzN194zS+eKxwLg2X y0SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PbSI7Zox; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q13si22378380pgq.238.2021.10.18.13.25.14; Mon, 18 Oct 2021 13:25:27 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=PbSI7Zox; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233225AbhJRU0L (ORCPT + 99 others); Mon, 18 Oct 2021 16:26:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbhJRU0K (ORCPT ); Mon, 18 Oct 2021 16:26:10 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFC1FC06161C for ; Mon, 18 Oct 2021 13:23:58 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id x27so2356714lfu.5 for ; Mon, 18 Oct 2021 13:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hShfojEUzBmMpgkHo84N+Rx+m8nkMxhA7mhDB+mvFaE=; b=PbSI7ZoxcTaW+kuQhPAk08kUDA6N4JkNzx4JdtEeIvmRiHWaCGCWKDwS6p4LCIWlXV mvD7jM3y71g8Pb8XfdxTsh+BKwVysAHHeT207AAb+9UJuUFmHz03UBHo4F3/Y6MRBOqP JyKGcbWzISB31bAwOjKCH781k5O7U0waP5sUjdWWgPH1t+CVYLVLvffMdChMKQuSNrmM 9slw4pVuAkNtXHI+PLvWKlNLboIYurC6OSS56c0Aa4egniPotDX5SSKnfWaitw6TyGcy O28Td5+5q41UXITz1jHSf9JIC3gfhf0JP2FNj4fPTjxvUIMm8FmqoTzFF+pCMfOfu/e2 lp3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hShfojEUzBmMpgkHo84N+Rx+m8nkMxhA7mhDB+mvFaE=; b=dWfXmLZOLjKja3ROfD0WuStPTw9jgcbJZm6hU5UgeOVJjGNT3rKYPgIXmdnrgaaBje Lx74Ip5d9/jXZ0ve4IFGJp/UcTZGUy/hLiyW/GgnT1lSamQ4KXmsNBz2HhApBqRXcux/ rMY+dkp8M35k7Xdp1rPyzRtFHabi7RBSoKSzEJ4QfdPHbhuXblL1vFDIWMtNZMHZeZgT omdAqEgN7ESL/f0qAucYDiZwYGs7dPvutrTOJM4LzCRN7sQrDHrJ8EDQ01bq/Sd3lJu7 wlBwv959IFTEH7a8vgH/cFgnfgteae6MRB8pnMe7mqrAhXfdcURLqjVp/kbsu5R1hpFm 9yUA== X-Gm-Message-State: AOAM530m5O6ZVQC/J9qpos1Q/QV7Moh1woLtyjqhX2IhRIWlNzauxbVV CWPegC87UFbOqM+coYBgWDdBDegHK/EMVPNrUlm3Qg== X-Received: by 2002:a05:6512:2284:: with SMTP id f4mr1819811lfu.489.1634588637140; Mon, 18 Oct 2021 13:23:57 -0700 (PDT) MIME-Version: 1.0 References: <20211014215703.3705371-1-nathan@kernel.org> <20211015094344.GQ8429@kadam> In-Reply-To: <20211015094344.GQ8429@kadam> From: Nick Desaulniers Date: Mon, 18 Oct 2021 13:23:45 -0700 Message-ID: Subject: Re: [PATCH] staging: wlan-ng: Avoid bitwise vs logical OR warning in hfa384x_usb_throttlefn() To: Dan Carpenter Cc: Nathan Chancellor , Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 15, 2021 at 2:44 AM Dan Carpenter wrote: > > On Thu, Oct 14, 2021 at 02:57:03PM -0700, Nathan Chancellor wrote: > > A new warning in clang points out a place in this file where a bitwise > > OR is being used with boolean expressions: > > > > In file included from drivers/staging/wlan-ng/prism2usb.c:2: > > drivers/staging/wlan-ng/hfa384x_usb.c:3787:7: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] > > ((test_and_clear_bit(THROTTLE_RX, &hw->usb_flags) && > > ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/staging/wlan-ng/hfa384x_usb.c:3787:7: note: cast one or both operands to int to silence this warning > > 1 warning generated. > > Both sides of this bitwise OR are bool, so | and || are equivalent > logically. Clang should not warn about it. Not when the LHS AND RHS of the the binary operator have side effects, which is the only condition under which this warning is emitted. RHS potentially sets a bit, and potentially would not be executed if `|` was replaced with `||`. -- Thanks, ~Nick Desaulniers