[PATCH] nvme: fix error-handling for io_uring nvme-passthrough

Niklas Cassel Niklas.Cassel at wdc.com
Wed Oct 18 11:05:30 PDT 2023


Hello Kanchan,

On Wed, Oct 18, 2023 at 07:27:18PM +0530, Kanchan Joshi wrote:
> From: Anuj Gupta <anuj20.g at samsung.com>
> 
> Driver may return an error before submitting the command to the device.
> Ensure that such error is propagated up.
> 
> Fixes: 456cba386e94 ("nvme: wire-up uring-cmd support for io-passthru on char-device.")
>

Why do you have an empty line between the Fixes and the Signed-off-by ?
(I noticed this on some of your other patches as well.)

I don't think there is supposed to be any empty lines between the tags.

> Signed-off-by: Anuj Gupta <anuj20.g at samsung.com>
> Signed-off-by: Kanchan Joshi <joshi.k at samsung.com>
> ---
>  drivers/nvme/host/ioctl.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
> index d8ff796fd5f2..53987df6ea7c 100644
> --- a/drivers/nvme/host/ioctl.c
> +++ b/drivers/nvme/host/ioctl.c
> @@ -508,8 +508,11 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
>  	req->bio = pdu->bio;
>  	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
>  		pdu->nvme_status = -EINTR;
> -	else
> +	else {
>  		pdu->nvme_status = nvme_req(req)->status;
> +		if (!pdu->nvme_status)
> +			pdu->nvme_status = blk_status_to_errno(err);
> +	}

The kernel coding standard says that you should have braces on the if,
even if it is a single line statement, when you have brances on the else:
https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces


Kind regards,
Niklas


More information about the Linux-nvme mailing list