Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2595934ybz; Mon, 27 Apr 2020 00:09:52 -0700 (PDT) X-Google-Smtp-Source: APiQypJjm2rnBqL0dz01tynPVkk5Id/09dGpIQcNcMApD20Sw0GudXKJdLBNCXmhjyEQshA2nNsU X-Received: by 2002:a50:e8cb:: with SMTP id l11mr18223764edn.174.1587971392672; Mon, 27 Apr 2020 00:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587971392; cv=none; d=google.com; s=arc-20160816; b=ZpAQzr04C8fgwzPciNC1Gm6zBC9eBbZlE9gDl4vVhvmK7lRXZ/xcZAwtYu0Zy/hYvL J/mvJkTeB6evumnHdNEXayAQcQRxxqUtlpDQnpPiPq5ec+p1SEcrP3W2tO7HjDN6MqAC cpDZAryrYtvQJIUzRopiV/mhXHTDEgHWjwV5k3LpV/Rgs9FJtjvm3jas6p2eBlIlogC0 J5mcAUX17wkpORvO2NdjvZKA8ofC2J6yB0TYyNv+AeRaQed77HHM4I72OY2Hr+sScdI8 nzz/hQHmse8tdR6+SnrXPl41mlqnYUfKzUl+XUGQokVchY2MlaETdNRuKPI5RxOTb072 yDsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3CxZwGBTt+ToXUeMtFGEKT2BZI/KNjbUZlpY/rw/Ztg=; b=NXXAtE63KYbX8rwMX3nIkby+4fuckIkIQUheQwBJxX20yKxe0PSITvhMrUbrVbF4Ye iAVWmuI5BRgIYaKJH2XjcmAeVdklxU7m1Iy10sPK1zldrFqEQgKf4wzBNrfawuNj6ZbF H4bHRXecIkAziMCwNtKBIBDose4tNtiHIm6ulttmyVtO7CSQS/MaDl1zItA0slFixzyc tcEi0DHffJj2I6LzzAmqPGHLVgw4l+X6YNbABBeGwLPDTLb2ty7KFx0/efVSNWDIVFRg TUS6q7KBIejpzVu+xK4mzURzCUviZJOATcAVfEEmo2jAdoS2l3gXJYJbwFTyjBsVnzxO 1Vvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=W2a981xv; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o16si7756073edi.482.2020.04.27.00.09.29; Mon, 27 Apr 2020 00:09:52 -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=@alien8.de header.s=dkim header.b=W2a981xv; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726605AbgD0HIM (ORCPT + 99 others); Mon, 27 Apr 2020 03:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbgD0HIM (ORCPT ); Mon, 27 Apr 2020 03:08:12 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 594ABC061A0F; Mon, 27 Apr 2020 00:08:12 -0700 (PDT) Received: from zn.tnic (p200300EC2F05F000D9541802070C4AE1.dip0.t-ipconnect.de [IPv6:2003:ec:2f05:f000:d954:1802:70c:4ae1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id F2D5D1EC0CDA; Mon, 27 Apr 2020 09:08:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1587971290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=3CxZwGBTt+ToXUeMtFGEKT2BZI/KNjbUZlpY/rw/Ztg=; b=W2a981xvH2aNCGTvcwxFjU0F46f/6RRi1rqoV5zYGK9c2LGLloo6nejMad5RsnNg3Yr6+R h3zLgOweECmDHK0Te5ziXOnmPWVOoXM9xyvInwmywrfjvgN7fliS+r2rBH9+Yfj6bqV606 repydKjEz666T8RBkLKYkdrNiD0BSHQ= Date: Mon, 27 Apr 2020 09:08:02 +0200 From: Borislav Petkov To: Robert Richter Cc: Mauro Carvalho Chehab , Tony Luck , James Morse , Aristeu Rozanski , Matthias Brugger , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 06/10] EDAC/ghes: Remove local variable rdr_mask in ghes_edac_dmidecode() Message-ID: <20200427070802.GA11036@zn.tnic> References: <20200422115814.22205-1-rrichter@marvell.com> <20200422115814.22205-7-rrichter@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200422115814.22205-7-rrichter@marvell.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 01:58:10PM +0200, Robert Richter wrote: > The local variable rdr_mask serves as a static constant here. It hides > what the code is doing. Remove it and replace it with the actual logic > that checks some bits. > > Signed-off-by: Robert Richter > --- > drivers/edac/ghes_edac.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c > index a5890afa9c71..038e560fd332 100644 > --- a/drivers/edac/ghes_edac.c > +++ b/drivers/edac/ghes_edac.c > @@ -191,7 +191,6 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) > if (dh->type == DMI_ENTRY_MEM_DEVICE) { > struct memdev_dmi_entry *entry = (struct memdev_dmi_entry *)dh; > struct dimm_info *dimm = edac_get_dimm(mci, dimm_fill->count, 0, 0); > - u16 rdr_mask = BIT(7) | BIT(13); > > if (entry->size == 0xffff) { > pr_info("Can't get DIMM%i size\n", > @@ -241,7 +240,8 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) > default: > if (entry->type_detail & BIT(6)) > dimm->mtype = MEM_RMBS; > - else if ((entry->type_detail & rdr_mask) == rdr_mask) > + else if ((entry->type_detail & BIT(7)) && > + (entry->type_detail & BIT(13))) Well, "checks some bits" doesn't make it more telling than checking a descriptive name like "rdr_mask" but ok, since we're assigning MEM_RDR here, it is still clear what the check does. Btw, please write it like this: else if (entry->type_detail & (BIT(7) | BIT(13))) Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette