From: Dave Jiang <dave.jiang@intel.com>
To: Linda Knippers <linda.knippers@hpe.com>, dan.j.williams@intel.com
Cc: linux-nvdimm@lists.01.org
Subject: Re: [PATCH 3/5] acpi: cleanup acpi_nfit_ctl calling xlat_status
Date: Wed, 8 Mar 2017 09:29:15 -0700 [thread overview]
Message-ID: <e565aec9-b400-6712-25b2-904a64b87dc4@intel.com> (raw)
In-Reply-To: <58BF4E4D.8000406@hpe.com>
On 03/07/2017 05:20 PM, Linda Knippers wrote:
> On 03/06/2017 03:32 PM, Dave Jiang wrote:
>> Make sure that xlat_status is unconditionally called.
>
> Is this just code cleanup or is it fixing something?
This is code clean up requested by Dan.
>
>>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
>> drivers/acpi/nfit/core.c | 15 +++++++--------
>> 1 file changed, 7 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
>> index 7361d00..9d4f461 100644
>> --- a/drivers/acpi/nfit/core.c
>> +++ b/drivers/acpi/nfit/core.c
>> @@ -199,7 +199,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
>> acpi_handle handle;
>> unsigned int func;
>> const u8 *uuid;
>> - int rc, i;
>> + int rc = 0, xlat_rc, i;
>>
>> func = cmd;
>> if (cmd == ND_CMD_CALL) {
>> @@ -343,21 +343,20 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
>> * unfilled in the output buffer
>> */
>> rc = buf_len - offset - in_buf.buffer.length;
>> - if (cmd_rc)
>> - *cmd_rc = xlat_status(nvdimm, buf, cmd,
>> - fw_status);
>> } else {
>> dev_err(dev, "%s:%s underrun cmd: %s buf_len: %d out_len: %d\n",
>> __func__, dimm_name, cmd_name, buf_len,
>> offset);
>> rc = -ENXIO;
>> + goto out;
>> }
>> - } else {
>> - rc = 0;
>> - if (cmd_rc)
>> - *cmd_rc = xlat_status(nvdimm, buf, cmd, fw_status);
>> }
>>
>> + xlat_rc = xlat_status(nvdimm, buf, cmd, fw_status);
>> +
>> + if (cmd_rc)
>> + *cmd_rc = xlat_rc;
>
> Is there some benefit of calling xlat_status and then throwing away the result?
It's not exactly thrown away. I tried to preserve the original code path
as much as possible. So in the current case, if xlat_status() fails,
then *cmd_rc gets it like in the original code. If it's succeeds, then
the forget_poison provides the status instead.
>
>> +
>> out:
>> ACPI_FREE(out_obj);
>>
>>
>> _______________________________________________
>> Linux-nvdimm mailing list
>> Linux-nvdimm@lists.01.org
>> https://lists.01.org/mailman/listinfo/linux-nvdimm
>>
>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2017-03-08 16:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 20:32 [PATCH 0/5] Adding clear poison path for device DAX Dave Jiang
2017-03-06 20:32 ` [PATCH 1/5] libnvdimm: Add mechanism to publish badblocks at nd region level Dave Jiang
2017-03-07 8:58 ` Johannes Thumshirn
2017-03-06 20:32 ` [PATCH 2/5] libnvdimm: Add resource sysfs attrib to nd region Dave Jiang
2017-03-07 8:59 ` Johannes Thumshirn
2017-03-06 20:32 ` [PATCH 3/5] acpi: cleanup acpi_nfit_ctl calling xlat_status Dave Jiang
2017-03-08 0:20 ` Linda Knippers
2017-03-08 16:29 ` Dave Jiang [this message]
2017-03-08 16:51 ` Linda Knippers
2017-03-08 17:10 ` Dan Williams
2017-03-06 20:32 ` [PATCH 4/5] acpi_nfit, libnvdimm: Add support for clear poison list and bad blocks Dave Jiang
2017-03-07 9:30 ` Johannes Thumshirn
2017-03-07 16:00 ` Dave Jiang
2017-03-07 16:11 ` Johannes Thumshirn
2017-03-06 20:32 ` [PATCH 5/5] libnvdimm: providing dax support for nvdimm testing Dave Jiang
2017-03-07 9:31 ` Johannes Thumshirn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e565aec9-b400-6712-25b2-904a64b87dc4@intel.com \
--to=dave.jiang@intel.com \
--cc=dan.j.williams@intel.com \
--cc=linda.knippers@hpe.com \
--cc=linux-nvdimm@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox