Re: [PATCH v2 06/10] EDAC/ghes: Remove local variable rdr_mask in ghes_edac_dmidecode()

From: Luck, Tony
Date: Mon Apr 27 2020 - 13:24:11 EST


On Mon, Apr 27, 2020 at 09:08:02AM +0200, Borislav Petkov wrote:
> > 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)))

That isn't the same. The previous version checked that BOTH bits
7 and 13 were set. Your version checks for either bit.

Looks like the original with the local variable was checking for both
bits set.

-Tony