Re: [PATCH v2 06/24] EDAC: Kill EDAC_DIMM_PTR() macro

Robert Richter
2019-08-27T12:20:27Z

On 13.08.19 16:59:47, Borislav Petkov wrote:
> > + *
> > + * For 2 layers, this macro is similar to allocate a bi-dimensional array
> > + * and to return "dimms[layer0][layer1]";
> > + *
> > + * For 3 layers, this macro is similar to allocate a tri-dimensional array
> > + * and to return "dimms[layer0][layer1][layer2]";
> > + */
> > +static inline struct dimm_info *
> > +edac_get_dimm(struct mem_ctl_info *mci, int layer0, int layer1, int layer2)
> > +{
> > + int index = layer0;
> > +
> > + if (index >= 0 && mci->n_layers > 1)
>
> Can layer0 be negative here to warrant that check?

Yes, if a mem controller can not determine a dimm's position, this
function can be called with layers set to -1.

I have reworked the patch according to all of your comments.

Thanks for review,

-Robert