All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: mtip32xx: Remove unnecessary function calls
@ 2025-01-20 16:20 Philipp Stanner
  2025-01-22  6:02 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stanner @ 2025-01-20 16:20 UTC (permalink / raw)
  To: Jens Axboe, Hannes Reinecke, Damien Le Moal, Philipp Stanner,
	John Garry, Li Zetao, Al Viro
  Cc: linux-block, linux-kernel

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.

Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
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/20241016094911.24818-6-pstanner@redhat.com/
[2] https://lore.kernel.org/all/20241107162459.71e0288a@canb.auug.org.au/
---
 drivers/block/mtip32xx/mtip32xx.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 43701b7b10a7..aa9badb9a51d 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -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);
 }
 
-- 
2.47.1


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

* Re: [PATCH] block: mtip32xx: Remove unnecessary function calls
  2025-01-20 16:20 [PATCH] block: mtip32xx: Remove unnecessary function calls Philipp Stanner
@ 2025-01-22  6:02 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2025-01-22  6:02 UTC (permalink / raw)
  To: Philipp Stanner, Jens Axboe, Hannes Reinecke, John Garry,
	Li Zetao, Al Viro
  Cc: linux-block, linux-kernel

On 1/21/25 1:20 AM, Philipp Stanner wrote:
> 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.
> 
> Signed-off-by: Philipp Stanner <phasta@kernel.org>

Looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

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

end of thread, other threads:[~2025-01-22  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 16:20 [PATCH] block: mtip32xx: Remove unnecessary function calls Philipp Stanner
2025-01-22  6:02 ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.