Skip to contentSkip to conversation

block: mtip32xx: Remove unnecessary function calls

PATCH In review Philipp Stanner 2 participants 2 messages Jan 20, 2025 – Jan 22, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: mtip32xx: Remove unnecessary function calls

pcim_iounmap_regions() does not have to be called, because the regions are automatically unmapped since they were mapped with managed functions. Moreover, that function is deprecated anyways.

Furthermore, setting the drvdata to NULL is unnecessary in a driver remove() function.

Remove the unnecessary calls.

---
This patch had been around before in a series [1], but I unfortunately messed it up and caused a race [2], which is why this patch here exists. It's independent and fixes the rest of the pcim_ API up in this driver once and for all :)

P.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

---
 drivers/block/mtip32xx/mtip32xx.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/block/mtip32xx/mtip32xx.c +2 -8
index 43701b7b10a7..aa9badb9a51d 100644
@@ -3718,7 +3718,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 	rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
 	if (rv) {
 		dev_warn(&pdev->dev, "64-bit DMA enable failed\n");
-		goto setmask_err;
+		goto iomap_err;
 	}
 
 	/* Copy the info we may need later into the private data structure. */
@@ -3734,7 +3734,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 	if (!dd->isr_workq) {
 		dev_warn(&pdev->dev, "Can't create wq %d\n", dd->instance);
 		rv = -ENOMEM;
-		goto setmask_err;
+		goto iomap_err;
 	}
 
 	memset(cpu_list, 0, sizeof(cpu_list));
@@ -3831,8 +3831,6 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 		drop_cpu(dd->work[1].cpu_binding);
 		drop_cpu(dd->work[2].cpu_binding);
 	}
-setmask_err:
-	pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
 
 iomap_err:
 	kfree(dd);
@@ -3907,10 +3905,6 @@ static void mtip_pci_remove(struct pci_dev *pdev)
 	}
 
 	pci_disable_msi(pdev);
-
-	pcim_iounmap_regions(pdev, 1 << MTIP_ABAR);
-	pci_set_drvdata(pdev, NULL);
-
 	put_disk(dd->disk);
 }
 
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Philipp Stanner

pcim_iounmap_regions() does not have to be called, because the regions are automatically unmapped since they were mapped with managed functions. Moreover, that function is deprecated anyways.

Furthermore, setting the drvdata to NULL is unnecessary in a driver remove() function.

Remove the unnecessary calls.

Looks OK to me.

Signature · 2 lines
Damien Le Moal
Western Digital Research