[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e8c4e8a3-bfc3-463f-afce-b9f600b588b2@suse.com>
Date: Wed, 28 Feb 2024 09:00:29 +0100
From: Oliver Neukum <oneukum@...e.com>
To: Weitao Wang <WeitaoWang-oc@...oxin.com>, oneukum@...e.com,
stern@...land.harvard.edu, gregkh@...uxfoundation.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-scsi@...r.kernel.org, usb-storage@...ts.one-eyed-alien.net
Cc: WeitaoWang@...oxin.com, stable@...r.kernel.org
Subject: Re: [PATCH v2] USB:UAS:return ENODEV when submit urbs fail with
device not attached.
On 28.02.24 12:15, Weitao Wang wrote:
Hi,
sorry for going at this again, but there are a few technical issues left.
Regards
Oliver
> ---
> v1->v2
> - Modify the description of this patch.
>
> drivers/usb/storage/uas.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
> index 9707f53cfda9..967f18db525a 100644
> --- a/drivers/usb/storage/uas.c
> +++ b/drivers/usb/storage/uas.c
> @@ -562,9 +561,9 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
>
> lockdep_assert_held(&devinfo->lock);
> if (cmdinfo->state & SUBMIT_STATUS_URB) {
> - urb = uas_submit_sense_urb(cmnd, GFP_ATOMIC);
> - if (!urb)
> - return SCSI_MLQUEUE_DEVICE_BUSY;
> + err = uas_submit_sense_urb(cmnd, GFP_ATOMIC);
> + if (err)
> + return (err == -ENODEV) ? -ENODEV : SCSI_MLQUEUE_DEVICE_BUSY;
Either we ought to use SCSI error codes or generic error codes.
There is no need to translate all but one error condition here.
> cmdinfo->state &= ~SUBMIT_STATUS_URB;
> }
>
> @@ -582,7 +581,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
> if (err) {
> usb_unanchor_urb(cmdinfo->data_in_urb);
> uas_log_cmd_state(cmnd, "data in submit err", err);
> - return SCSI_MLQUEUE_DEVICE_BUSY;
> + return (err == -ENODEV) ? -ENODEV : SCSI_MLQUEUE_DEVICE_BUSY;
Same as above and below.
Powered by blists - more mailing lists