The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=aaec2a90b5cecd38520ecb0ffa23f116d36933f3

commit aaec2a90b5cecd38520ecb0ffa23f116d36933f3
Author:     Warner Losh <[email protected]>
AuthorDate: 2026-01-08 06:19:21 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2026-01-08 06:19:21 +0000

    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
---
 sys/cam/scsi/scsi_all.c | 18 ++++++++----------
 1 file 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 */
 

Reply via email to