Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1053157pxb; Thu, 21 Oct 2021 14:57:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPoWzxmpduvKGKUFRFgpAY4qdLntjZFVklrYM5yalGcBrafKawzXqLP9Up0lS0gQteqUQb X-Received: by 2002:a63:b64e:: with SMTP id v14mr6399124pgt.56.1634853475754; Thu, 21 Oct 2021 14:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634853475; cv=none; d=google.com; s=arc-20160816; b=nQl/WyCOZ/rcEcmFaamAx0wm9H2K1H8AxB9bOVtCO+hWS7OnWfM7YrdEohDPn7a25o 6TutnsU12L71xiM/DWdvg5HqapGjfSwfqdLXEpCau4CfZ1txeJKdiXEjc06yvDjZS/ZJ MHBcoZO66W0ogZn0y56fWJ3yvlVFMP3px/tMJVCaMOtXmcOEktl0Uo0vFtA0N1LSn5vf G15w/9JNnsjmgji2qvWJFj8rWLFhqGzZEj66J45hUXzCP9YwvKntZp0uXn16N1u81m6S reXl7Ln817yB9VOr3mFSBUQwDQdvBh77nQLy0GbNhmWUdCsk3XAwWSUPQKg80MVDiuZk xJww== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZCGRyXV+yFg604KerT6lfLqQ/FcBsXnY1K8TUtQtSI0=; b=aUELpXKl7r5DVOsowMIArzz7cvBCOOjKbegDFnr/alTL8xfHINBgPfN6HQYuAVyWtM 4gnlbcSANULhBQLT8/gTelbMe3wXurLK3hw9H5kPtLHd83IBel4GWMX00dhFjxWsjVQK s6cDmISq45GUdob97ZSE5pbtOhikj0/cFy5/6PCHAg2V96N5Iev/31gLbYLlsjFyhUMD ovJWgi44c+MMjKrFV5zmqAG8Bw0QaMZSYyP0GxVvxFm3jC0jjP/6RSeynkNDWoI/OIhK BiLBGIiI7hOgehgDU5zgtE+WKvv1AhfuMUG/ACiH28E4Nrl4txhd4mIjmSliEbGNudpF 3s+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=ZNLBtizd; 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=rere.qmqm.pl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si10379545pfu.330.2021.10.21.14.57.42; Thu, 21 Oct 2021 14:57:55 -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=@rere.qmqm.pl header.s=1 header.b=ZNLBtizd; 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=rere.qmqm.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232131AbhJUV5y (ORCPT + 99 others); Thu, 21 Oct 2021 17:57:54 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:8121 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232021AbhJUV5x (ORCPT ); Thu, 21 Oct 2021 17:57:53 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4Hb1WD08yCz6R; Thu, 21 Oct 2021 23:55:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1634853336; bh=6csxCuz1kr9C+uMndLSTwSrGXfiVLf7UG+RAN5kMi18=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZNLBtizdfizXmbnqRgyLuWVFJqh4sVO+KGwEmv64Cbgc4TuRtMyUuB4XffFLsKsNH cAq/rgWguqUErt3+nlha6LSQnDI+8FmyuBwmNErt3L+GOCpOzqkk7YkQznZikVHV/d DKDY09d2+kDgnDsCDYdCS0q6nGyJNielShyP05UZlnhfmQ8Omr0+alVbb1Kk0bnhwI Z5+/i0rj+FHVGI56fDYO+P5FPRKP7DxSPZ06KNRgbADjTgayBATPE0OKdMzAdYWyyS PzcSAPZs+aeB4Sub8MOTEAabVSxOAvq75jlyDYJbBWRB0soc4dpPem/c9bIVIDyyay dX2usiqf37C4g== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.3 at mail Date: Thu, 21 Oct 2021 23:55:34 +0200 From: =?iso-8859-2?Q?Micha=B3_Miros=B3aw?= To: Nathan Chancellor Cc: Thierry Reding , Jonathan Hunter , Nick Desaulniers , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] soc/tegra: fuse: Fix bitwise vs. logical OR warning Message-ID: References: <20211021214500.2388146-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211021214500.2388146-1-nathan@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 02:45:00PM -0700, Nathan Chancellor wrote: [...] > --- a/drivers/soc/tegra/fuse/speedo-tegra20.c > +++ b/drivers/soc/tegra/fuse/speedo-tegra20.c > @@ -69,7 +69,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info) > > val = 0; > for (i = CPU_SPEEDO_MSBIT; i >= CPU_SPEEDO_LSBIT; i--) { > - reg = tegra_fuse_read_spare(i) | > + reg = tegra_fuse_read_spare(i) || > tegra_fuse_read_spare(i + CPU_SPEEDO_REDUND_OFFS); > val = (val << 1) | (reg & 0x1); > } > @@ -84,7 +84,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info) > > val = 0; > for (i = SOC_SPEEDO_MSBIT; i >= SOC_SPEEDO_LSBIT; i--) { > - reg = tegra_fuse_read_spare(i) | > + reg = tegra_fuse_read_spare(i) || > tegra_fuse_read_spare(i + SOC_SPEEDO_REDUND_OFFS); > val = (val << 1) | (reg & 0x1); > } It does seem correct, but nevertheless the code looks suspicious. reg is already masked with 0x1 as far as I can tell, and there are other places which depend on this (like speedo-tegra210.c). Guessing from the use of tegra_fuse_read_spare() I would recommend changing its return type as it is returing a bit value, not necessarily semantically a boolean. Best Regards Micha? Miros?aw