USB: add SPDX identifiers to all remaining files in drivers/usb/
[linux-2.6-block.git] / drivers / usb / storage / usb.c
index 0dceb9fa3a0629af3bd1a1990508d2c32bb42db2..7b1524be01bb8a3cf2b105481eff86e3dccd4241 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Driver for USB Mass Storage compliant devices
  *
@@ -332,7 +333,7 @@ static int usb_stor_control_thread(void * __us)
 
                /* When we are called with no command pending, we're done */
                srb = us->srb;
-               if (us->srb == NULL) {
+               if (srb == NULL) {
                        scsi_unlock(host);
                        mutex_unlock(&us->dev_mutex);
                        usb_stor_dbg(us, "-- exiting\n");
@@ -341,7 +342,7 @@ static int usb_stor_control_thread(void * __us)
 
                /* has the command timed out *already* ? */
                if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
-                       us->srb->result = DID_ABORT << 16;
+                       srb->result = DID_ABORT << 16;
                        goto SkipForAbort;
                }
 
@@ -351,35 +352,35 @@ static int usb_stor_control_thread(void * __us)
                 * reject the command if the direction indicator
                 * is UNKNOWN
                 */
-               if (us->srb->sc_data_direction == DMA_BIDIRECTIONAL) {
+               if (srb->sc_data_direction == DMA_BIDIRECTIONAL) {
                        usb_stor_dbg(us, "UNKNOWN data direction\n");
-                       us->srb->result = DID_ERROR << 16;
+                       srb->result = DID_ERROR << 16;
                }
 
                /*
                 * reject if target != 0 or if LUN is higher than
                 * the maximum known LUN
                 */
-               else if (us->srb->device->id &&
+               else if (srb->device->id &&
                                !(us->fflags & US_FL_SCM_MULT_TARG)) {
                        usb_stor_dbg(us, "Bad target number (%d:%llu)\n",
-                                    us->srb->device->id,
-                                    us->srb->device->lun);
-                       us->srb->result = DID_BAD_TARGET << 16;
+                                    srb->device->id,
+                                    srb->device->lun);
+                       srb->result = DID_BAD_TARGET << 16;
                }
 
-               else if (us->srb->device->lun > us->max_lun) {
+               else if (srb->device->lun > us->max_lun) {
                        usb_stor_dbg(us, "Bad LUN (%d:%llu)\n",
-                                    us->srb->device->id,
-                                    us->srb->device->lun);
-                       us->srb->result = DID_BAD_TARGET << 16;
+                                    srb->device->id,
+                                    srb->device->lun);
+                       srb->result = DID_BAD_TARGET << 16;
                }
 
                /*
                 * Handle those devices which need us to fake
                 * their inquiry data
                 */
-               else if ((us->srb->cmnd[0] == INQUIRY) &&
+               else if ((srb->cmnd[0] == INQUIRY) &&
                            (us->fflags & US_FL_FIX_INQUIRY)) {
                        unsigned char data_ptr[36] = {
                            0x00, 0x80, 0x02, 0x02,
@@ -387,13 +388,13 @@ static int usb_stor_control_thread(void * __us)
 
                        usb_stor_dbg(us, "Faking INQUIRY command\n");
                        fill_inquiry_response(us, data_ptr, 36);
-                       us->srb->result = SAM_STAT_GOOD;
+                       srb->result = SAM_STAT_GOOD;
                }
 
                /* we've got a command, let's do it! */
                else {
-                       US_DEBUG(usb_stor_show_command(us, us->srb));
-                       us->proto_handler(us->srb, us);
+                       US_DEBUG(usb_stor_show_command(us, srb));
+                       us->proto_handler(srb, us);
                        usb_mark_last_busy(us->pusb_dev);
                }
 
@@ -401,7 +402,7 @@ static int usb_stor_control_thread(void * __us)
                scsi_lock(host);
 
                /* was the command aborted? */
-               if (us->srb->result == DID_ABORT << 16) {
+               if (srb->result == DID_ABORT << 16) {
 SkipForAbort:
                        usb_stor_dbg(us, "scsi command aborted\n");
                        srb = NULL;     /* Don't call srb->scsi_done() */