Commit d71afa9d authored by Yihang Li's avatar Yihang Li Committed by Martin K. Petersen
Browse files

scsi: scsi_transport_sas: Fix the maximum channel scanning issue



After commit 37c4e72b ("scsi: Fix sas_user_scan() to handle wildcard
and multi-channel scans"), if the device supports multiple channels (0 to
shost->max_channel), user_scan() invokes updated sas_user_scan() to perform
the scan behavior for a specific transfer.  However, when the user
specifies shost->max_channel, it will return -EINVAL, which is not
expected.

Fix and support specifying the scan shost->max_channel for scanning.

Fixes: 37c4e72b ("scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans")
Signed-off-by: default avatarYihang Li <liyihang9@huawei.com>
Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
Link: https://patch.msgid.link/20260317063147.2182562-1-liyihang9@huawei.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 1333eee5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1734,7 +1734,7 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
		break;

	default:
		if (channel < shost->max_channel) {
		if (channel <= shost->max_channel) {
			res = scsi_scan_host_selected(shost, channel, id, lun,
						      SCSI_SCAN_MANUAL);
		} else {