scsi: pm80xx: Do not use libsas port id
Subsystems (2)
PATCH 1/1 scsi: pm80xx: Do not use libsas port id
From: Igor Pylypiv <[email protected]>
libsas port ids can differ from the controller's port ids. Using libsas port id to index pm8001_ha->port array is a bug.
Remove sas_find_local_port_id(). We can use pm8001_ha->phy[phy_id].port to get the port id.
--- drivers/scsi/pm8001/pm8001_sas.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
drivers/scsi/pm8001/pm8001_sas.c +2 -19
@@ -374,23 +374,6 @@ static int pm8001_task_prep_ssp(struct pm8001_hba_info *pm8001_ha,return PM8001_CHIP_DISP ->ssp_io_req (pm8001_ha, ccb); } -/* Find the local port id that's attached to this device */ -static int sas_find_local_port_id (struct domain_device *dev) -{ -struct domain_device *pdev = dev->parent; - -/* Directly attached device */ -if (!pdev) -return dev->port->id; -while (pdev) { -struct domain_device *pdev_p = pdev->parent; -if (!pdev_p) -return pdev->port->id; - pdev = pdev->parent; - } -return 0 ; -} -#define DEV_IS_GONE (pm8001_dev) \ ((!pm8001_dev || (pm8001_dev->dev_type == SAS_PHY_UNUSED)))
@@ -463,10 +446,10 @@ int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags)spin_lock_irqsave (&pm8001_ha->lock, flags); pm8001_dev = dev->lldd_dev; - port = &pm8001_ha->port[sas_find_local_port_id (dev)]; + port = pm8001_ha->phy[pm8001_dev->attached_phy].port;if (!internal_abort && - (DEV_IS_GONE (pm8001_dev) || !port->port_attached)) { + (DEV_IS_GONE (pm8001_dev) || !port || !port->port_attached)) { ts->resp =SAS_TASK_UNDELIVERED ; ts->stat =SAS_PHY_DOWN ;if (sas_protocol_ata (task_proto)) {
Signature · 1 line
2.47.0.371.ga323438b13-goog
Martin K. Petersen
AppliedTJ,
Quoted 2 lines
libsas port ids can differ from the controller's port ids. Using libsas port id to index
pm8001_ha->portarray is a bug.
Applied to 6.14/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · TJ Adams
libsas port ids can differ from the controller's port ids. Using libsas port id to index
pm8001_ha->portarray is a bug.Remove
sas_find_local_port_id(). We can use pm8001_ha->phy[phy_id].port to get the port id.[...]
Applied to 6.14/scsi-queue, thanks!
[1/1] scsi: pm80xx: Do not use libsas port id
https://git.kernel.org/mkp/scsi/c/0f630c58e31a
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering