On Mon, Jan 14, 2019 at 10:11 AM Vishal Verma <vishal.l.ve...@intel.com> wrote: > > It is possible for ndctl_cmd_submit to return a positive number, > indicating a buffer underrun. It is only truly an error if it returns a > negative number. Several places in the library, the ndctl utility, and > in test/ were simply checking for an error with "if (rc)". Fix these to > only error out for negative returns. > > Cc: Dan Williams <dan.j.willi...@intel.com> > Signed-off-by: Vishal Verma <vishal.l.ve...@intel.com> > --- > ndctl/lib/dimm.c | 6 +++--- > ndctl/lib/inject.c | 8 ++++---- > ndctl/lib/nfit.c | 2 +- > ndctl/util/json-firmware.c | 2 +- > test/ack-shutdown-count-set.c | 8 ++------ > test/daxdev-errors.c | 8 ++++---- > test/libndctl.c | 32 ++++++++++++++++---------------- > test/smart-notify.c | 8 ++++---- > 8 files changed, 35 insertions(+), 39 deletions(-) > > diff --git a/ndctl/lib/dimm.c b/ndctl/lib/dimm.c > index 79e2ca0..12dc74a 100644 > --- a/ndctl/lib/dimm.c > +++ b/ndctl/lib/dimm.c > @@ -332,7 +332,7 @@ static int nvdimm_set_config_data(struct nvdimm_data > *ndd, size_t offset, > goto out; > > rc = ndctl_cmd_submit(cmd_write); > - if (rc || ndctl_cmd_get_firmware_status(cmd_write)) > + if ((rc < 0) || ndctl_cmd_get_firmware_status(cmd_write))
With ndctl_cmd_submit_xlat() the ndctl_cmd_get_firmware_status() can be dropped, right? rc = ndctl_cmd_submit_xlat(cmd_write); if (rc < 0) rc = -ENXIO; ...or are you saving that conversion for a follow on patch? _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm