Add SPC version verification to avoid unnecessary inquiry command Signed-off-by: Yohan Joung <yohan.joung@xxxxxx> --- drivers/scsi/sd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6203915945a4..9d71ad24d8e3 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3413,11 +3413,16 @@ static inline sector_t sd64_to_sectors(struct scsi_disk *sdkp, u8 *buf) static void sd_read_cpr(struct scsi_disk *sdkp) { struct blk_independent_access_ranges *iars = NULL; + struct scsi_device *sdev = sdkp->device; unsigned char *buffer = NULL; unsigned int nr_cpr = 0; int i, vpd_len, buf_len = SD_BUF_SIZE; u8 *desc; + /* Support for CPR was defined in SPC-5. */ + if (sdev->scsi_level < SCSI_SPC_5) + return; + /* * We need to have the capacity set first for the block layer to be * able to check the ranges. -- 2.25.1