lkml.org 
[lkml]   [2020]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH net-next v2 1/3] net: dec: tulip: de2104x: Replace alloc_etherdev by devm_alloc_etherdev
Date
Replace devm_alloc_etherdev() with its devres version.

Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
drivers/net/ethernet/dec/tulip/de2104x.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
index 42b798a3fad4..9bcfc82b71d1 100644
--- a/drivers/net/ethernet/dec/tulip/de2104x.c
+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
@@ -1986,7 +1986,7 @@ static int de_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif

/* allocate a new ethernet device structure, and fill in defaults */
- dev = alloc_etherdev(sizeof(struct de_private));
+ dev = devm_alloc_etherdev(&pdev->dev, sizeof(struct de_private));
if (!dev)
return -ENOMEM;

@@ -2011,7 +2011,7 @@ static int de_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
/* wake up device, assign resources */
rc = pci_enable_device(pdev);
if (rc)
- goto err_out_free;
+ return rc;

/* reserve PCI resources to ensure driver atomicity */
rc = pci_request_regions(pdev, DRV_NAME);
@@ -2098,8 +2098,6 @@ static int de_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_release_regions(pdev);
err_out_disable:
pci_disable_device(pdev);
-err_out_free:
- free_netdev(dev);
return rc;
}

@@ -2114,7 +2112,6 @@ static void de_remove_one(struct pci_dev *pdev)
iounmap(de->regs);
pci_release_regions(pdev);
pci_disable_device(pdev);
- free_netdev(dev);
}

#ifdef CONFIG_PM
--
2.28.0
\
 
 \ /
  Last update: 2020-09-15 06:25    [W:0.052 / U:2.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site