Skip to contentSkip to conversation

hisi_sas: Some misc minor patches

PATCH Applied John Garry 2 participants 7 messages Nov 12, 2019 – Nov 13, 2019

Subsystems (2)
lore
Share & tools
lore

John Garry

author
#0 lore raw

cover hisi_sas: Some misc minor patches

This series includes some misc patches which were sitting on our internal dev branch.

Nothing extra special to note, just really some tidying and very minor fixes.

John Garry (1):
scsi: hisi_sas: Stop converting a bool into a bool

Xiang Chen (3):
scsi: hisi_sas: Check sas_port before using it
scsi: hisi_sas: Return directly if init hardware failed
scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit()

 drivers/scsi/hisi_sas/hisi_sas_main.c  | 5 +++--
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/4 scsi: hisi_sas: Check sas_port before using it

From: Xiang Chen <[email protected]>

Need to check the structure sas_port before using it.

---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +2 -1
index 18c95b33592b..c72fc59353bd 100644
@@ -974,12 +974,13 @@ static void hisi_sas_port_notify_formed(struct asd_sas_phy *sas_phy)
 	struct hisi_hba *hisi_hba = sas_ha->lldd_ha;
 	struct hisi_sas_phy *phy = sas_phy->lldd_phy;
 	struct asd_sas_port *sas_port = sas_phy->port;
-	struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
+	struct hisi_sas_port *port;
 	unsigned long flags;
 
 	if (!sas_port)
 		return;
 
+	port = to_hisi_sas_port(sas_port);
 	spin_lock_irqsave(&hisi_hba->lock, flags);
 	port->port_attached = 1;
 	port->id = phy->port_id;
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/4 scsi: hisi_sas: Return directly if init hardware failed

In reply to John Garry

From: Xiang Chen <[email protected]>

Need to return directly if init hardware failed.

Fixes 73a4925d154c ("scsi: hisi_sas: Update all the registers after suspend and resume")
---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -0
index 2ae7070db41a..b7836406debe 100644
@@ -3432,6 +3432,7 @@ static int hisi_sas_v3_resume(struct pci_dev *pdev)
 	if (rc) {
 		scsi_remove_host(shost);
 		pci_disable_device(pdev);
+		return rc;
 	}
 	hisi_hba->hw->phys_init(hisi_hba);
 	sas_resume_ha(sha);
Signature · 1 line
2.17.1
author
#3 lore raw

Re: [PATCH 2/4] scsi: hisi_sas: Return directly if init hardware failed

Quoted 6 lines · John Garry

From: Xiang Chen <[email protected]>

Need to return directly if init hardware failed.

Fixes 73a4925d154c ("scsi: hisi_sas: Update all the registers after suspend and resume")

I missed my tag here:

Quoted 17 lines
---
  drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 +
  1 file changed, 1 insertion(+)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -0
index 2ae7070db41a..b7836406debe 100644
@@ -3432,6 +3432,7 @@ static int hisi_sas_v3_resume(struct pci_dev *pdev)
  	if (rc) {
  		scsi_remove_host(shost);
  		pci_disable_device(pdev);
+		return rc;
  	}
  	hisi_hba->hw->phys_init(hisi_hba);
  	sas_resume_ha(sha);
author
#4 lore raw

PATCH 3/4 scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit()

In reply to John Garry

From: Xiang Chen <[email protected]>

Currently we call function hisi_sas_debugfs_exit() to remove debugfs_dir before freeing interrupt irqs and destroying workqueue in the driver remove path.

If a dump is triggered before function hisi_sas_debugfs_exit() but debugfs_work may be called after it, so it may refer to already removed debugfs_dir which will cause NULL pointer dereference.

To avoid it, put function hisi_sas_debugfs_exit() after free_irqs and destroy workqueue when removing hisi_sas driver.

---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -2
index b7836406debe..bf5d5f138437 100644
@@ -3302,8 +3302,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
 	struct hisi_hba *hisi_hba = sha->lldd_ha;
 	struct Scsi_Host *shost = sha->core.shost;
 
-	hisi_sas_debugfs_exit(hisi_hba);
-
 	if (timer_pending(&hisi_hba->timer))
 		del_timer(&hisi_hba->timer);
 
@@ -3315,6 +3313,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 	hisi_sas_free(hisi_hba);
+	hisi_sas_debugfs_exit(hisi_hba);
 	scsi_host_put(shost);
 }
 
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH 4/4 scsi: hisi_sas: Stop converting a bool into a bool

In reply to John Garry

The !! operator on a bool is pointless, so remove an example in hisi_sas_rescan_topology().

---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
index c72fc59353bd..03588ec3c394 100644
@@ -1413,7 +1413,7 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state)
 		struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
 		struct asd_sas_phy *sas_phy = &phy->sas_phy;
 		struct asd_sas_port *sas_port = sas_phy->port;
-		bool do_port_check = !!(_sas_port != sas_port);
+		bool do_port_check = _sas_port != sas_port;
 
 		if (!sas_phy->phy->enabled)
 			continue;
Signature · 1 line
2.17.1
#6 lore raw
In reply to John Garry

John,

Quoted 5 lines

This series includes some misc patches which were sitting on our internal dev branch.

Nothing extra special to note, just really some tidying and very minor fixes.

Applied to 5.5/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering