diff mbox

vmw_pvscsi: Don't call free_irq twice on remove adapter

Message ID 20171004190331.icpl7ku5tcwe4igm@petr-dev3.eng.vmware.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Jim Gill Oct. 4, 2017, 7:03 p.m. UTC
Remove redundant call to pvscsi_shutdown_intr from
pvscsi_remove_resources.  Add calls to pvscsi_shutdown_intr
in the failure cases for pvscsi_probe.

Signed-off-by: Jim Gill <jgill@vmware.com>
---
 drivers/scsi/vmw_pvscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kyle Fortin Oct. 5, 2017, 5:55 p.m. UTC | #1
Hi Jim,

On Oct 4, 2017, at 3:03 PM, Jim Gill <jgill@vmware.com> wrote:
> 
> Remove redundant call to pvscsi_shutdown_intr from
> pvscsi_remove_resources.  Add calls to pvscsi_shutdown_intr
> in the failure cases for pvscsi_probe.
> 
> Signed-off-by: Jim Gill <jgill@vmware.com>
> ---
> drivers/scsi/vmw_pvscsi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
> index c374e3b..c7e74ac 100644
> --- a/drivers/scsi/vmw_pvscsi.c
> +++ b/drivers/scsi/vmw_pvscsi.c
> @@ -1197,8 +1197,6 @@ static void pvscsi_shutdown_intr(struct pvscsi_adapter *adapter)
> 
> static void pvscsi_release_resources(struct pvscsi_adapter *adapter)
> {
> -	pvscsi_shutdown_intr(adapter);
> -
> 	if (adapter->workqueue)
> 		destroy_workqueue(adapter->workqueue);
> 
> @@ -1530,6 +1528,7 @@ static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> out_reset_adapter:

From what I understand the irq(s) are not allocated until the pci_alloc_irq_vectors call.  After, all breakout jumps are to out_reset_adapter.

Could it be simplified to just adding pvscsi_shutdown_intr before ll_adapter_reset() here?  Then you don’t need the other two pvscsi_shutdown_intr() calls below.

> 	ll_adapter_reset(adapter);
> out_release_resources:
> +	pvscsi_shutdown_intr(adapter);
> 	pvscsi_release_resources(adapter);
> 	scsi_host_put(host);
> out_disable_device:
> @@ -1538,6 +1537,7 @@ static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> 	return error;
> 
> out_release_resources_and_disable:
> +	pvscsi_shutdown_intr(adapter);
> 	pvscsi_release_resources(adapter);
> 	goto out_disable_device;
> }
> -- 
> 2.7.4

--
Kyle Fortin - Oracle Linux Engineering
Kyle Fortin Oct. 5, 2017, 6:03 p.m. UTC | #2
Correction.

On Oct 5, 2017, at 1:55 PM, Kyle Fortin <kyle.fortin@oracle.com> wrote:
> 
> Hi Jim,
> 
> On Oct 4, 2017, at 3:03 PM, Jim Gill <jgill@vmware.com> wrote:
>> 
>> Remove redundant call to pvscsi_shutdown_intr from
>> pvscsi_remove_resources.  Add calls to pvscsi_shutdown_intr
>> in the failure cases for pvscsi_probe.
>> 
>> Signed-off-by: Jim Gill <jgill@vmware.com>
>> ---
>> drivers/scsi/vmw_pvscsi.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
>> index c374e3b..c7e74ac 100644
>> --- a/drivers/scsi/vmw_pvscsi.c
>> +++ b/drivers/scsi/vmw_pvscsi.c
>> @@ -1197,8 +1197,6 @@ static void pvscsi_shutdown_intr(struct pvscsi_adapter *adapter)
>> 
>> static void pvscsi_release_resources(struct pvscsi_adapter *adapter)
>> {
>> -	pvscsi_shutdown_intr(adapter);
>> -
>> 	if (adapter->workqueue)
>> 		destroy_workqueue(adapter->workqueue);
>> 
>> @@ -1530,6 +1528,7 @@ static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>> out_reset_adapter:
> 
> From what I understand the irq(s) are not allocated until the pci_alloc_irq_vectors call.  After, all breakout jumps are to out_reset_adapter.
> 
> Could it be simplified to just adding pvscsi_shutdown_intr before ll_adapter_reset() here?  Then you don’t need the other two pvscsi_shutdown_intr() calls below.

Add pvscsi_shutdown_intr after adapter reset instead.

>> 	ll_adapter_reset(adapter);
>> out_release_resources:
>> +	pvscsi_shutdown_intr(adapter);
>> 	pvscsi_release_resources(adapter);
>> 	scsi_host_put(host);
>> out_disable_device:
>> @@ -1538,6 +1537,7 @@ static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>> 	return error;
>> 
>> out_release_resources_and_disable:
>> +	pvscsi_shutdown_intr(adapter);
>> 	pvscsi_release_resources(adapter);
>> 	goto out_disable_device;
>> }
>> -- 
>> 2.7.4
> 
> --
> Kyle Fortin - Oracle Linux Engineering
diff mbox

Patch

diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index c374e3b..c7e74ac 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -1197,8 +1197,6 @@  static void pvscsi_shutdown_intr(struct pvscsi_adapter *adapter)
 
 static void pvscsi_release_resources(struct pvscsi_adapter *adapter)
 {
-	pvscsi_shutdown_intr(adapter);
-
 	if (adapter->workqueue)
 		destroy_workqueue(adapter->workqueue);
 
@@ -1530,6 +1528,7 @@  static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 out_reset_adapter:
 	ll_adapter_reset(adapter);
 out_release_resources:
+	pvscsi_shutdown_intr(adapter);
 	pvscsi_release_resources(adapter);
 	scsi_host_put(host);
 out_disable_device:
@@ -1538,6 +1537,7 @@  static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	return error;
 
 out_release_resources_and_disable:
+	pvscsi_shutdown_intr(adapter);
 	pvscsi_release_resources(adapter);
 	goto out_disable_device;
 }