Re: [PATCH v2] USB:UAS:return ENODEV when submit urbs fail with device not attached.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 28.02.24 23:32, WeitaoWang-oc@xxxxxxxxxxx wrote:

@@ -602,6 +606,8 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
          if (err) {
              usb_unanchor_urb(cmdinfo->data_out_urb);
              uas_log_cmd_state(cmnd, "data out submit err", err);
+            if (err == -ENODEV)
+                return -ENODEV;

This is a generic error code from errno.h

              return SCSI_MLQUEUE_DEVICE_BUSY;

This is not.

          }
          cmdinfo->state &= ~SUBMIT_DATA_OUT_URB;
@@ -621,6 +627,8 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
          if (err) {
              usb_unanchor_urb(cmdinfo->cmd_urb);
              uas_log_cmd_state(cmnd, "cmd submit err", err);
+            if (err == -ENODEV)
+                return -ENODEV;
              return SCSI_MLQUEUE_DEVICE_BUSY;
          }

I'm not sure I fully understand what your mean.
Whether the above code is more reasonable? If not,could you give me some
suggestion? Thanks for your help!

You want to change uas_submit_urbs() to return the reason for
errors, because -ENODEV needs to be handled differently. That
is good.
But why don't you just do

return err;

unconditionally? There is no point in using SCSI_MLQUEUE_DEVICE_BUSY

	Regards
		Oliver





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux