Merge tag 'nfsd-5.14' of git://linux-nfs.org/~bfields/linux
[linux-2.6-microblaze.git] / drivers / scsi / scsi_debug.c
index a5d1633..5b3a20a 100644 (file)
@@ -851,10 +851,10 @@ static struct device_driver sdebug_driverfs_driver = {
 };
 
 static const int check_condition_result =
-               (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
+       SAM_STAT_CHECK_CONDITION;
 
 static const int illegal_condition_result =
-       (DRIVER_SENSE << 24) | (DID_ABORT << 16) | SAM_STAT_CHECK_CONDITION;
+       (DID_ABORT << 16) | SAM_STAT_CHECK_CONDITION;
 
 static const int device_qfull_result =
        (DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
@@ -931,7 +931,7 @@ static void mk_sense_invalid_fld(struct scsi_cmnd *scp,
        }
        asc = c_d ? INVALID_FIELD_IN_CDB : INVALID_FIELD_IN_PARAM_LIST;
        memset(sbuff, 0, SCSI_SENSE_BUFFERSIZE);
-       scsi_build_sense_buffer(sdebug_dsense, sbuff, ILLEGAL_REQUEST, asc, 0);
+       scsi_build_sense(scp, sdebug_dsense, ILLEGAL_REQUEST, asc, 0);
        memset(sks, 0, sizeof(sks));
        sks[0] = 0x80;
        if (c_d)
@@ -957,17 +957,14 @@ static void mk_sense_invalid_fld(struct scsi_cmnd *scp,
 
 static void mk_sense_buffer(struct scsi_cmnd *scp, int key, int asc, int asq)
 {
-       unsigned char *sbuff;
-
-       sbuff = scp->sense_buffer;
-       if (!sbuff) {
+       if (!scp->sense_buffer) {
                sdev_printk(KERN_ERR, scp->device,
                            "%s: sense_buffer is NULL\n", __func__);
                return;
        }
-       memset(sbuff, 0, SCSI_SENSE_BUFFERSIZE);
+       memset(scp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 
-       scsi_build_sense_buffer(sdebug_dsense, sbuff, key, asc, asq);
+       scsi_build_sense(scp, sdebug_dsense, key, asc, asq);
 
        if (sdebug_verbose)
                sdev_printk(KERN_INFO, scp->device,
@@ -7684,11 +7681,6 @@ static int sdebug_driver_remove(struct device *dev)
 
        sdbg_host = to_sdebug_host(dev);
 
-       if (!sdbg_host) {
-               pr_err("Unable to locate host info\n");
-               return -ENODEV;
-       }
-
        scsi_remove_host(sdbg_host->shost);
 
        list_for_each_entry_safe(sdbg_devinfo, tmp, &sdbg_host->dev_info_list,