lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190309052126.23761-1-rosenp@gmail.com>
Date:   Fri,  8 Mar 2019 21:21:26 -0800
From:   Rosen Penev <rosenp@...il.com>
To:     netdev@...r.kernel.org
Cc:     igor.russkikh@...antia.com
Subject: [PATCH] net: aquantia: Switch alloc_etherdev to devm variant

Allows some simplification by avoiding calling free_netdev.

Tested on AMD based x86 system using AQC108 chipset.

Signed-off-by: Rosen Penev <rosenp@...il.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c     |  3 ++-
 drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 11 +++--------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
index 2a11c1eefd8f..319c564c28b2 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
@@ -30,7 +30,8 @@ struct net_device *aq_ndev_alloc(void)
 	struct net_device *ndev = NULL;
 	struct aq_nic_s *aq_nic = NULL;
 
-	ndev = alloc_etherdev_mq(sizeof(struct aq_nic_s), AQ_CFG_VECS_MAX);
+	ndev = devm_alloc_etherdev_mq(aq_nic->ndev, sizeof(struct aq_nic_s),
+				      AQ_CFG_VECS_MAX);
 	if (!ndev)
 		return NULL;
 
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
index c8b44cdb91c1..ce3e4ca9ab68 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
@@ -224,13 +224,11 @@ static int aq_pci_probe(struct pci_dev *pdev,
 	err = aq_pci_probe_get_hw_by_id(pdev, &self->aq_hw_ops,
 					&aq_nic_get_cfg(self)->aq_hw_caps);
 	if (err)
-		goto err_ioremap;
+		return err;
 
 	self->aq_hw = kzalloc(sizeof(*self->aq_hw), GFP_KERNEL);
-	if (!self->aq_hw) {
-		err = -ENOMEM;
-		goto err_ioremap;
-	}
+	if (!self->aq_hw)
+		return -ENOMEM;
 	self->aq_hw->aq_nic_cfg = aq_nic_get_cfg(self);
 
 	for (bar = 0; bar < 4; ++bar) {
@@ -296,8 +294,6 @@ static int aq_pci_probe(struct pci_dev *pdev,
 	iounmap(self->aq_hw->mmio);
 err_free_aq_hw:
 	kfree(self->aq_hw);
-err_ioremap:
-	free_netdev(ndev);
 err_ndev:
 	pci_release_regions(pdev);
 err_pci_func:
@@ -318,7 +314,6 @@ static void aq_pci_remove(struct pci_dev *pdev)
 		iounmap(self->aq_hw->mmio);
 		kfree(self->aq_hw);
 		pci_release_regions(pdev);
-		free_netdev(self->ndev);
 	}
 
 	pci_disable_device(pdev);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ