Re: [PATCH] acpi/nfit: Fix command-supported detection

From: Jeff Moyer
Date: Mon Jan 14 2019 - 15:51:54 EST


Dan Williams <dan.j.williams@xxxxxxxxx> writes:

> On Mon, Jan 14, 2019 at 8:43 AM Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
>> On Mon, Jan 14, 2019 at 7:19 AM Jeff Moyer <jmoyer@xxxxxxxxxx> wrote:
> [..]
>> > > +
>> > > + if (cmd == ND_CMD_CALL) {
>> > > + int i;
>> > > +
>> > > + if (call_pkg && nfit_mem->family != call_pkg->nd_family)
>> > > + return -ENOTTY;
>> > > +
>> > > + for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++)
>> > > + if (call_pkg->nd_reserved2[i])
>> > > + return -EINVAL;
>> > > + return call_pkg->nd_command;
>> > > + }
>> > > +
>> > > + /* Linux ND commands == NVDIMM_FAMILY_INTEL function numbers */
>> > > + if (nfit_mem->family == NVDIMM_FAMILY_INTEL)
>> > > + return cmd;
>> > > + return 0;
>> >
>> > Function zero? Is that really the right thing to return here?
>>
>> Yes, function zero is never set in n
>
> ...whoops fumble fingered "send"
>
> Function zero should never be set in nfit_mem->dsm_mask, although the
> NVDIMM_FAMILY_MSFT mask violates this assumption. I'll fix that up.

OK, I think I see how it all fits together now, thanks. It would be
nice if you documented this magical 0 return somehow.

Cheers,
Jeff