diff mbox series

net: enetc: Use pci_release_region() to release some resources

Message ID b0dcb6124717d13900e48b2f1fa697b922f672b2.1653643529.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Commit 18eeb4dea65cb587057740d6b7b71a13bcfececd
Delegated to: Netdev Maintainers
Headers show
Series net: enetc: Use pci_release_region() to release some resources | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Christophe JAILLET May 27, 2022, 9:25 a.m. UTC
Some resources are allocated using pci_request_region().
It is more straightforward to release them with pci_release_region().

Fixes: 231ece36f50d ("enetc: Add mdio bus driver for the PCIe MDIO endpoint")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative, mainly based on the inconsistency between some
function's names.
Using pci_request_mem_regions() would also have things look consistent.

Review with care.
---
 drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Claudiu Manoil May 27, 2022, 5:51 p.m. UTC | #1
> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Sent: Friday, May 27, 2022 12:26 PM
[...]
> Subject: [PATCH] net: enetc: Use pci_release_region() to release some
> resources
> 
> Some resources are allocated using pci_request_region().
> It is more straightforward to release them with pci_release_region().
> 
> Fixes: 231ece36f50d ("enetc: Add mdio bus driver for the PCIe MDIO
> endpoint")
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative, mainly based on the inconsistency between some
> function's names.
> Using pci_request_mem_regions() would also have things look consistent.
> 
> Review with care.
> ---

Since the external MDIO registers are located in BAR 0 of the PCIe endpoint device,
the driver requests specifically the BAR 0 mem region and should release the same
region. So the fix is valid. Thanks.

Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
patchwork-bot+netdevbpf@kernel.org May 28, 2022, 7:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 27 May 2022 11:25:47 +0200 you wrote:
> Some resources are allocated using pci_request_region().
> It is more straightforward to release them with pci_release_region().
> 
> Fixes: 231ece36f50d ("enetc: Add mdio bus driver for the PCIe MDIO endpoint")
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> [...]

Here is the summary with links:
  - net: enetc: Use pci_release_region() to release some resources
    https://git.kernel.org/netdev/net/c/18eeb4dea65c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
index 15f37c5b8dc1..dafb26f81f95 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
@@ -69,7 +69,7 @@  static int enetc_pci_mdio_probe(struct pci_dev *pdev,
 	return 0;
 
 err_mdiobus_reg:
-	pci_release_mem_regions(pdev);
+	pci_release_region(pdev, 0);
 err_pci_mem_reg:
 	pci_disable_device(pdev);
 err_pci_enable:
@@ -88,7 +88,7 @@  static void enetc_pci_mdio_remove(struct pci_dev *pdev)
 	mdiobus_unregister(bus);
 	mdio_priv = bus->priv;
 	iounmap(mdio_priv->hw->port);
-	pci_release_mem_regions(pdev);
+	pci_release_region(pdev, 0);
 	pci_disable_device(pdev);
 }