scsi: hisi_sas: Drop free_irq() when devm_request_irq() failed

It will free irq automatically if devm_request_irq() failed, so drop
free_irq() if devm_request_irq() failed.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Xiang Chen 2019-08-05 21:48:08 +08:00 коммит произвёл Martin K. Petersen
Родитель 5f6c32d7ce
Коммит e16963f378
2 изменённых файлов: 11 добавлений и 44 удалений

Просмотреть файл

@ -3304,8 +3304,8 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
{ {
struct platform_device *pdev = hisi_hba->platform_dev; struct platform_device *pdev = hisi_hba->platform_dev;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int irq, rc, irq_map[128]; int irq, rc = 0, irq_map[128];
int i, phy_no, fatal_no, queue_no, k; int i, phy_no, fatal_no, queue_no;
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
irq_map[i] = platform_get_irq(pdev, i); irq_map[i] = platform_get_irq(pdev, i);
@ -3318,7 +3318,7 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
dev_err(dev, "irq init: could not request phy interrupt %d, rc=%d\n", dev_err(dev, "irq init: could not request phy interrupt %d, rc=%d\n",
irq, rc); irq, rc);
rc = -ENOENT; rc = -ENOENT;
goto free_phy_int_irqs; goto err_out;
} }
} }
@ -3332,7 +3332,7 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
dev_err(dev, "irq init: could not request sata interrupt %d, rc=%d\n", dev_err(dev, "irq init: could not request sata interrupt %d, rc=%d\n",
irq, rc); irq, rc);
rc = -ENOENT; rc = -ENOENT;
goto free_sata_int_irqs; goto err_out;
} }
} }
@ -3344,7 +3344,7 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
dev_err(dev, "irq init: could not request fatal interrupt %d, rc=%d\n", dev_err(dev, "irq init: could not request fatal interrupt %d, rc=%d\n",
irq, rc); irq, rc);
rc = -ENOENT; rc = -ENOENT;
goto free_fatal_int_irqs; goto err_out;
} }
} }
@ -3359,34 +3359,14 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
dev_err(dev, "irq init: could not request cq interrupt %d, rc=%d\n", dev_err(dev, "irq init: could not request cq interrupt %d, rc=%d\n",
irq, rc); irq, rc);
rc = -ENOENT; rc = -ENOENT;
goto free_cq_int_irqs; goto err_out;
} }
tasklet_init(t, cq_tasklet_v2_hw, (unsigned long)cq); tasklet_init(t, cq_tasklet_v2_hw, (unsigned long)cq);
} }
hisi_hba->cq_nvecs = hisi_hba->queue_count; hisi_hba->cq_nvecs = hisi_hba->queue_count;
return 0; err_out:
free_cq_int_irqs:
for (k = 0; k < queue_no; k++) {
struct hisi_sas_cq *cq = &hisi_hba->cq[k];
free_irq(irq_map[k + 96], cq);
tasklet_kill(&cq->tasklet);
}
free_fatal_int_irqs:
for (k = 0; k < fatal_no; k++)
free_irq(irq_map[k + 81], hisi_hba);
free_sata_int_irqs:
for (k = 0; k < phy_no; k++) {
struct hisi_sas_phy *phy = &hisi_hba->phy[k];
free_irq(irq_map[k + 72], phy);
}
free_phy_int_irqs:
for (k = 0; k < i; k++)
free_irq(irq_map[k + 1], hisi_hba);
return rc; return rc;
} }

Просмотреть файл

@ -2351,8 +2351,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
{ {
struct device *dev = hisi_hba->dev; struct device *dev = hisi_hba->dev;
struct pci_dev *pdev = hisi_hba->pci_dev; struct pci_dev *pdev = hisi_hba->pci_dev;
int vectors, rc; int vectors, rc, i;
int i, k;
int max_msi = HISI_SAS_MSI_COUNT_V3_HW, min_msi; int max_msi = HISI_SAS_MSI_COUNT_V3_HW, min_msi;
if (auto_affine_msi_experimental) { if (auto_affine_msi_experimental) {
@ -2400,7 +2399,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
if (rc) { if (rc) {
dev_err(dev, "could not request chnl interrupt, rc=%d\n", rc); dev_err(dev, "could not request chnl interrupt, rc=%d\n", rc);
rc = -ENOENT; rc = -ENOENT;
goto free_phy_irq; goto free_irq_vectors;
} }
rc = devm_request_irq(dev, pci_irq_vector(pdev, 11), rc = devm_request_irq(dev, pci_irq_vector(pdev, 11),
@ -2409,7 +2408,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
if (rc) { if (rc) {
dev_err(dev, "could not request fatal interrupt, rc=%d\n", rc); dev_err(dev, "could not request fatal interrupt, rc=%d\n", rc);
rc = -ENOENT; rc = -ENOENT;
goto free_chnl_interrupt; goto free_irq_vectors;
} }
/* Init tasklets for cq only */ /* Init tasklets for cq only */
@ -2426,7 +2425,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
dev_err(dev, "could not request cq%d interrupt, rc=%d\n", dev_err(dev, "could not request cq%d interrupt, rc=%d\n",
i, rc); i, rc);
rc = -ENOENT; rc = -ENOENT;
goto free_cq_irqs; goto free_irq_vectors;
} }
tasklet_init(t, cq_tasklet_v3_hw, (unsigned long)cq); tasklet_init(t, cq_tasklet_v3_hw, (unsigned long)cq);
@ -2434,18 +2433,6 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
return 0; return 0;
free_cq_irqs:
for (k = 0; k < i; k++) {
struct hisi_sas_cq *cq = &hisi_hba->cq[k];
int nr = hisi_sas_intr_conv ? 16 : 16 + k;
free_irq(pci_irq_vector(pdev, nr), cq);
}
free_irq(pci_irq_vector(pdev, 11), hisi_hba);
free_chnl_interrupt:
free_irq(pci_irq_vector(pdev, 2), hisi_hba);
free_phy_irq:
free_irq(pci_irq_vector(pdev, 1), hisi_hba);
free_irq_vectors: free_irq_vectors:
pci_free_irq_vectors(pdev); pci_free_irq_vectors(pdev);
return rc; return rc;