mi: make return values + errno consistent across error paths
This change unifies and documents the error return values for the MI
implementation. This gives us the following semantics:
- zero on success
- -1 for errors in the MI communication with an endpoint, with errno
set accordingly
- positive values where the MI communication succeeded, but we received
an error response from the endpoint. The return value will be that
from the MI response status field, and should correspond to one of
the nvme_mi_resp_status values.
We add these semantics to the file-level kdoc comments in mi.h.
Most of the changes here are replacing the negative-errno returns:
return -EIO;
with:
errno = EIO;
return -1;
but there are a few slightly-more-involved changes where we need to
preserve errno across a cleanup/log that might clobber it.
For the dbus code in mi-mctp.c, we need to convert the sd_bus convention of
negative-errno values into errno; we can do most of these through the
dbus_err() helper.
Fixes: https://github.com/linux-nvme/libnvme/issues/417 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>