linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] hisi_sas: Some misc minor patches
@ 2019-11-12  9:30 John Garry
  2019-11-12  9:30 ` [PATCH 1/4] scsi: hisi_sas: Check sas_port before using it John Garry
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: John Garry @ 2019-11-12  9:30 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, linuxarm, linux-kernel, John Garry

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(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] scsi: hisi_sas: Check sas_port before using it
  2019-11-12  9:30 [PATCH 0/4] hisi_sas: Some misc minor patches John Garry
@ 2019-11-12  9:30 ` John Garry
  2019-11-12  9:30 ` [PATCH 2/4] scsi: hisi_sas: Return directly if init hardware failed John Garry
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: John Garry @ 2019-11-12  9:30 UTC (permalink / raw)
  To: jejb, martin.petersen
  Cc: linux-scsi, linuxarm, linux-kernel, Xiang Chen, John Garry

From: Xiang Chen <chenxiang66@hisilicon.com>

Need to check the structure sas_port before using it.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 18c95b33592b..c72fc59353bd 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] scsi: hisi_sas: Return directly if init hardware failed
  2019-11-12  9:30 [PATCH 0/4] hisi_sas: Some misc minor patches John Garry
  2019-11-12  9:30 ` [PATCH 1/4] scsi: hisi_sas: Check sas_port before using it John Garry
@ 2019-11-12  9:30 ` John Garry
  2019-11-12  9:36   ` John Garry
  2019-11-12  9:30 ` [PATCH 3/4] scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit() John Garry
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: John Garry @ 2019-11-12  9:30 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, linuxarm, linux-kernel, Xiang Chen

From: Xiang Chen <chenxiang66@hisilicon.com>

Need to return directly if init hardware failed.

Fixes: 73a4925d154c ("scsi: hisi_sas: Update all the registers after suspend and resume")
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index 2ae7070db41a..b7836406debe 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit()
  2019-11-12  9:30 [PATCH 0/4] hisi_sas: Some misc minor patches John Garry
  2019-11-12  9:30 ` [PATCH 1/4] scsi: hisi_sas: Check sas_port before using it John Garry
  2019-11-12  9:30 ` [PATCH 2/4] scsi: hisi_sas: Return directly if init hardware failed John Garry
@ 2019-11-12  9:30 ` John Garry
  2019-11-12  9:30 ` [PATCH 4/4] scsi: hisi_sas: Stop converting a bool into a bool John Garry
  2019-11-13  2:15 ` [PATCH 0/4] hisi_sas: Some misc minor patches Martin K. Petersen
  4 siblings, 0 replies; 7+ messages in thread
From: John Garry @ 2019-11-12  9:30 UTC (permalink / raw)
  To: jejb, martin.petersen
  Cc: linux-scsi, linuxarm, linux-kernel, Xiang Chen, John Garry

From: Xiang Chen <chenxiang66@hisilicon.com>

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.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index b7836406debe..bf5d5f138437 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -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);
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] scsi: hisi_sas: Stop converting a bool into a bool
  2019-11-12  9:30 [PATCH 0/4] hisi_sas: Some misc minor patches John Garry
                   ` (2 preceding siblings ...)
  2019-11-12  9:30 ` [PATCH 3/4] scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit() John Garry
@ 2019-11-12  9:30 ` John Garry
  2019-11-13  2:15 ` [PATCH 0/4] hisi_sas: Some misc minor patches Martin K. Petersen
  4 siblings, 0 replies; 7+ messages in thread
From: John Garry @ 2019-11-12  9:30 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, linuxarm, linux-kernel, John Garry

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

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index c72fc59353bd..03588ec3c394 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/4] scsi: hisi_sas: Return directly if init hardware failed
  2019-11-12  9:30 ` [PATCH 2/4] scsi: hisi_sas: Return directly if init hardware failed John Garry
@ 2019-11-12  9:36   ` John Garry
  0 siblings, 0 replies; 7+ messages in thread
From: John Garry @ 2019-11-12  9:36 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, linuxarm, linux-kernel, Xiang Chen

On 12/11/2019 09:30, John Garry wrote:
> From: Xiang Chen <chenxiang66@hisilicon.com>
> 
> Need to return directly if init hardware failed.
> 
> Fixes: 73a4925d154c ("scsi: hisi_sas: Update all the registers after suspend and resume")
> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>

I missed my tag here:
Signed-off-by: John Garry <john.garry@huawei.com>

> ---
>   drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> index 2ae7070db41a..b7836406debe 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> @@ -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);
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] hisi_sas: Some misc minor patches
  2019-11-12  9:30 [PATCH 0/4] hisi_sas: Some misc minor patches John Garry
                   ` (3 preceding siblings ...)
  2019-11-12  9:30 ` [PATCH 4/4] scsi: hisi_sas: Stop converting a bool into a bool John Garry
@ 2019-11-13  2:15 ` Martin K. Petersen
  4 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-11-13  2:15 UTC (permalink / raw)
  To: John Garry; +Cc: jejb, martin.petersen, linux-scsi, linuxarm, linux-kernel


John,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-13  2:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12  9:30 [PATCH 0/4] hisi_sas: Some misc minor patches John Garry
2019-11-12  9:30 ` [PATCH 1/4] scsi: hisi_sas: Check sas_port before using it John Garry
2019-11-12  9:30 ` [PATCH 2/4] scsi: hisi_sas: Return directly if init hardware failed John Garry
2019-11-12  9:36   ` John Garry
2019-11-12  9:30 ` [PATCH 3/4] scsi: hisi_sas: Relocate call to hisi_sas_debugfs_exit() John Garry
2019-11-12  9:30 ` [PATCH 4/4] scsi: hisi_sas: Stop converting a bool into a bool John Garry
2019-11-13  2:15 ` [PATCH 0/4] hisi_sas: Some misc minor patches Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).