* [PATCH] net: aquantia: Switch alloc_etherdev to devm variant
@ 2019-03-09 5:21 Rosen Penev
2019-03-09 14:14 ` kbuild test robot
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2019-03-09 5:21 UTC (permalink / raw)
To: netdev; +Cc: igor.russkikh
Allows some simplification by avoiding calling free_netdev.
Tested on AMD based x86 system using AQC108 chipset.
Signed-off-by: Rosen Penev <rosenp@gmail.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: aquantia: Switch alloc_etherdev to devm variant
2019-03-09 5:21 [PATCH] net: aquantia: Switch alloc_etherdev to devm variant Rosen Penev
@ 2019-03-09 14:14 ` kbuild test robot
0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2019-03-09 14:14 UTC (permalink / raw)
To: Rosen Penev; +Cc: kbuild-all, netdev, igor.russkikh
[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]
Hi Rosen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on v5.0 next-20190306]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Rosen-Penev/net-aquantia-Switch-alloc_etherdev-to-devm-variant/20190309-181154
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/aquantia/atlantic/aq_main.c:33:16: sparse: error: undefined identifier 'devm_alloc_etherdev_mq'
vim +/devm_alloc_etherdev_mq +33 drivers/net/ethernet/aquantia/atlantic/aq_main.c
27
28 struct net_device *aq_ndev_alloc(void)
29 {
30 struct net_device *ndev = NULL;
31 struct aq_nic_s *aq_nic = NULL;
32
> 33 ndev = devm_alloc_etherdev_mq(aq_nic->ndev, sizeof(struct aq_nic_s),
34 AQ_CFG_VECS_MAX);
35 if (!ndev)
36 return NULL;
37
38 aq_nic = netdev_priv(ndev);
39 aq_nic->ndev = ndev;
40 ndev->netdev_ops = &aq_ndev_ops;
41 ndev->ethtool_ops = &aq_ethtool_ops;
42
43 return ndev;
44 }
45
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67264 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-09 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 5:21 [PATCH] net: aquantia: Switch alloc_etherdev to devm variant Rosen Penev
2019-03-09 14:14 ` kbuild test robot
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.