Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3130268rdb; Thu, 16 Nov 2023 00:29:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6pQW7RT6YLmhJfplNFQFIEWSEa3CDiRcE9db5N9XTcvWI94FqLB2vwdVqWavmYG0tUMSU X-Received: by 2002:a17:90b:716:b0:27d:469b:8847 with SMTP id s22-20020a17090b071600b0027d469b8847mr1503354pjz.3.1700123398582; Thu, 16 Nov 2023 00:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700123398; cv=none; d=google.com; s=arc-20160816; b=i1fwUTRIXMzPdOVrEq+DYY/hEXuv8hRWHmLiI6yj+g6vX73byWVdecMNpuSXOt7eAm 3nlmqmbws+8N7L5FxURdeWSCHhZNMVGONxj7ckNZW3y0cfc9K499qXuH0ioAaFTrQrCx baDQAN7tgqG9WlXXb1znE5SECYNWOoUFRm+CIDXSdQtxFXx9/83KWbChIVdsXrBcAcbA QRMR+Y6Ix//pffymjVHoWatQGqpJXJx95MBeqv/ZcadjWDOVCqTezzZXEtSNuf5/H4IG VCLY8UVq8ld21tfEJ9G+m5VOUKga9Ps0jJFWXyI3KbIIrQ9mzJAsZ3Aj61k5Em6NH7dO HG2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=eOVvLjbAbS3A1sGuF2Qf0GUeZnuUBL4669xd8H5ux9I=; fh=QjO9yEHN9Mw584YzWJmC0gqAb5vGOxvZuRQofhpTj3Q=; b=wlxUxTZ60bnnd+6g05qtmXB7MyzXRZG7v47blj4dGK8zD48h7aSRqp0/OmC+Uf675c NAOZQCkpRVWOfnZYxh4qrIITZmevTRgaJHIiEHvKxDUn7h2+QuBLfMmi8/SB0zLSSr5E yOou8RqLX2XwMt0/fxU8+dwUNFv6/afDbQFwoQKigluh5Lw7XFbdVPrWRSNhXBcwTIRJ LpGBFhNtwsg27jwM6C2yrIcmPU7yy0tzeqYvbEL1/KZmiaw1jm4gxo+GiB+q9B3oHlj9 zjOHfg615llwCgtLTLOmaXUYgJwd+9ABQ/Aw+CnOvt/zcvSFziLBvuk1xmnoKgJGtNs6 blrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b7CvO+dU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ei15-20020a17090ae54f00b002800b0fa4f2si1512660pjb.104.2023.11.16.00.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:29:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b7CvO+dU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E8C4E801D5A3; Thu, 16 Nov 2023 00:29:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235208AbjKPI32 (ORCPT + 99 others); Thu, 16 Nov 2023 03:29:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235171AbjKPI3T (ORCPT ); Thu, 16 Nov 2023 03:29:19 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F671A4; Thu, 16 Nov 2023 00:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700123352; x=1731659352; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=1CVrMRbvtQ3pJscWj0o6EOAB5D9FaFRwLJwW7gUZatg=; b=b7CvO+dUQ36ZI/CzrwqxT29/PAnVdJgCSiDTTTIJgs7RCyKABjpNnlyc PTGBWe3hYNujUxjM+3yVUD2chlCGfw9XXF5NeasdlZIVC4lhZaRK99Hpk UJ/NISAwzqOtCZwEVFhEnq700hdNPo4aSGjaAvB+odw3HsxxhqwRnOFxn HHOsZQ0Q8A4w09uMZh4aIgOUVEvyZVu+WY0um7UinphQINwcUO4SdQsRO 0T6fhHknyOuLA9Grenxbxswlkrxpy4WxfxL5bGhO8z3J139I5e1eIm9Ag NjwAcsyvlkF+HKwDonbOVecVziiYQheuO9G7ricDQRlFbU1j/74RQ/i7n w==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="376087763" X-IronPort-AV: E=Sophos;i="6.03,307,1694761200"; d="scan'208";a="376087763" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 00:29:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="855909743" X-IronPort-AV: E=Sophos;i="6.03,307,1694761200"; d="scan'208";a="855909743" Received: from qiuxu-clx.sh.intel.com ([10.239.53.109]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 00:29:08 -0800 From: Qiuxu Zhuo To: andriy.shevchenko@linux.intel.com Cc: bp@alien8.de, james.morse@arm.com, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, mchehab@kernel.org, rric@kernel.org, tony.luck@intel.com, qiuxu.zhuo@intel.com Subject: Re: [PATCH v1 2/3] EDAC, pnd2: Apply bit macros and helpers where it makes sense Date: Thu, 16 Nov 2023 16:28:57 +0800 Message-Id: <20231116082857.89714-1-qiuxu.zhuo@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231115154940.664664-2-andriy.shevchenko@linux.intel.com> References: <20231115154940.664664-2-andriy.shevchenko@linux.intel.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 00:29:56 -0800 (PST) > From: Andy Shevchenko > ... > > Apply bit macros (BIT()/BIT_ULL()/GENMASK()/etc) and helpers > (is_power_of_2()/for_each_set_bit()/etc) where it makes sense. > > Signed-off-by: Andy Shevchenko > --- > drivers/edac/pnd2_edac.c | 39 ++++++++++++++++++--------------------- > 1 file changed, 18 insertions(+), 21 deletions(-) > > ... > @@ -328,7 +328,7 @@ static void mk_region_mask(char *name, struct region *rp, u64 base, u64 mask) > pr_info(FW_BUG "MOT mask cannot be zero\n"); > return; > } > - if (mask != GENMASK_ULL(PND_MAX_PHYS_BIT, __ffs(mask))) { > + if (is_power_of_2(mask)) { The original code verifies whether the 'mask' contains consecutive 1s between the most significant bit 'PND_MAX_PHYS_BIT' and the least significant bit '__ffs(mask)'. It isn't the check whether the 'mask' is power of 2. > pr_info(FW_BUG "MOT mask not power of two\n"); This original pr_info "MOT mask not power of two" is incorrect. May need to update it like: pr_info(FW_BUG "MOT mask is invalid\n"); > ... > /* addrdec values */ > #define AMAP_1KB 0 > @@ -1061,12 +1061,13 @@ static int check_channel(int ch) > > static int apl_check_ecc_active(void) > { > - int i, ret = 0; > + unsigned int i; > + int ret; Need to initialize the 'ret' to 0. The LKP reported this warnning as well: https://lore.kernel.org/all/202311160352.PfYDQfkU-lkp@intel.com/ > > /* Check dramtype and ECC mode for each present DIMM */ > - for (i = 0; i < APL_NUM_CHANNELS; i++) > - if (chan_mask & BIT(i)) > - ret += check_channel(i); > + for_each_set_bit(i, &chan_mask, APL_NUM_CHANNELS) > + ret += check_channel(i); > + > return ret ? -EINVAL : 0; > } > ... Thanks! -Qiuxu