aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2026-01-08 06:19:21 +0000
committerWarner Losh <imp@FreeBSD.org>2026-01-08 06:19:21 +0000
commitaaec2a90b5cecd38520ecb0ffa23f116d36933f3 (patch)
tree234d6890a8fd9a3a31c80271ed2e9ec4daab25b4
parent1a7151f79664644b2e7c8e69427be8b846e9c1a4 (diff)
cam: When inq data isn't valid, pass NULL
When the device isn't there, we don't have valid inq data. Pass NULL in this case. All the routines that receive this test against NULL already. Sponsored by: Netflix Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D54470
-rw-r--r--sys/cam/scsi/scsi_all.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index 4ea2ab7d4acd..d8bba97e79bc 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -3711,13 +3711,12 @@ scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio,
xpt_gdev_type(cgd, csio->ccb_h.path);
/*
- * If the device is unconfigured, just pretend that it is a hard
- * drive. scsi_op_desc() needs this.
+ * If the device is unconfigured, the inq data is invalid.
*/
if (cgd->ccb_h.status == CAM_DEV_NOT_THERE)
- cgd->inq_data.device = T_DIRECT;
-
- inq_data = &cgd->inq_data;
+ inq_data = NULL;
+ else
+ inq_data = &cgd->inq_data;
#else /* !_KERNEL */
@@ -5170,13 +5169,12 @@ scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio,
xpt_gdev_type(cgd, csio->ccb_h.path);
/*
- * If the device is unconfigured, just pretend that it is a hard
- * drive. scsi_op_desc() needs this.
+ * If the device is unconfigured, the inq data is invalid.
*/
if (cgd->ccb_h.status == CAM_DEV_NOT_THERE)
- cgd->inq_data.device = T_DIRECT;
-
- inq_data = &cgd->inq_data;
+ inq_data = NULL;
+ else
+ inq_data = &cgd->inq_data;
#else /* !_KERNEL */