[PATCH] libnvdimm/bus: return the outvar 'cmd_rc' error code in __nd_ioctl()
Jeff Moyer
jmoyer at redhat.com
Wed Feb 19 08:00:09 AEDT 2020
Vaibhav Jain <vaibhav at linux.ibm.com> writes:
> Presently the error code returned via out variable 'cmd_rc' from the
> nvdimm-bus controller function is ignored when called from
> __nd_ioctl() and never communicated back to user-space code that called
> an ioctl on dimm/bus.
>
> This minor patch updates __nd_ioctl() to propagate the value of out
> variable 'cmd_rc' back to user-space in case it reports an error.
>
> Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
> ---
> drivers/nvdimm/bus.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
> index a8b515968569..5b687a27fdf2 100644
> --- a/drivers/nvdimm/bus.c
> +++ b/drivers/nvdimm/bus.c
> @@ -1153,6 +1153,11 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
> if (rc < 0)
> goto out_unlock;
>
> + if (cmd_rc < 0) {
> + rc = cmd_rc;
> + goto out_unlock;
> + }
> +
> if (!nvdimm && cmd == ND_CMD_CLEAR_ERROR && cmd_rc >= 0) {
> struct nd_cmd_clear_error *clear_err = buf;
Looks good to me.
Reviewed-by: Jeff Moyer <jmoyer at redhat.com>
More information about the Linuxppc-dev
mailing list