Skip to content

Commit a19226f

Browse files
johnpgarrymartinkpetersen
authored andcommitted
scsi: scsi_debug: Drop scsi_debug_device_reset() NULL pointer checks
The SCSI cmnd pointer arg would never be NULL, so drop the check. In addition, its SCSI device pointer would never be NULL (so drop that check also). The only caller is scsi_try_bus_device_reset(), and the command and its device pointer could not be NULL when calling eh_device_reset_handler() there. Signed-off-by: John Garry <john.g.garry@oracle.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Link: https://lore.kernel.org/r/20230313093114.1498305-5-john.g.garry@oracle.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 06be9fb commit a19226f

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

drivers/scsi/scsi_debug.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5372,17 +5372,16 @@ static int scsi_debug_abort(struct scsi_cmnd *SCpnt)
53725372

53735373
static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt)
53745374
{
5375+
struct scsi_device *sdp = SCpnt->device;
5376+
struct sdebug_dev_info *devip = sdp->hostdata;
5377+
53755378
++num_dev_resets;
5376-
if (SCpnt && SCpnt->device) {
5377-
struct scsi_device *sdp = SCpnt->device;
5378-
struct sdebug_dev_info *devip =
5379-
(struct sdebug_dev_info *)sdp->hostdata;
53805379

5381-
if (SDEBUG_OPT_ALL_NOISE & sdebug_opts)
5382-
sdev_printk(KERN_INFO, sdp, "%s\n", __func__);
5383-
if (devip)
5384-
set_bit(SDEBUG_UA_POR, devip->uas_bm);
5385-
}
5380+
if (SDEBUG_OPT_ALL_NOISE & sdebug_opts)
5381+
sdev_printk(KERN_INFO, sdp, "%s\n", __func__);
5382+
if (devip)
5383+
set_bit(SDEBUG_UA_POR, devip->uas_bm);
5384+
53865385
return SUCCESS;
53875386
}
53885387

0 commit comments

Comments
 (0)