Message ID | 20240808041109.6871-1-rosenp@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: hplance: use devm in probe | expand |
Hi Rosen, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-hplance-use-devm-in-probe/20240808-121217 base: net-next/main patch link: https://lore.kernel.org/r/20240808041109.6871-1-rosenp%40gmail.com patch subject: [PATCH net-next] net: hplance: use devm in probe config: m68k-defconfig (https://download.01.org/0day-ci/archive/20240809/202408090740.vJYOceuz-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240809/202408090740.vJYOceuz-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202408090740.vJYOceuz-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/net/ethernet/amd/hplance.c: In function 'hplance_init_one': >> drivers/net/ethernet/amd/hplance.c:87:74: error: macro "devm_alloc_etherdev" requires 2 arguments, but only 1 given 87 | dev = devm_alloc_etherdev(sizeof(&d->dev, struct hplance_private)); | ^ In file included from drivers/net/ethernet/amd/hplance.c:24: include/linux/etherdevice.h:64:9: note: macro "devm_alloc_etherdev" defined here 64 | #define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1) | ^~~~~~~~~~~~~~~~~~~ >> drivers/net/ethernet/amd/hplance.c:87:15: error: 'devm_alloc_etherdev' undeclared (first use in this function); did you mean 'devm_alloc_etherdev_mqs'? 87 | dev = devm_alloc_etherdev(sizeof(&d->dev, struct hplance_private)); | ^~~~~~~~~~~~~~~~~~~ | devm_alloc_etherdev_mqs drivers/net/ethernet/amd/hplance.c:87:15: note: each undeclared identifier is reported only once for each function it appears in vim +/devm_alloc_etherdev +87 drivers/net/ethernet/amd/hplance.c 80 81 /* Find all the HP Lance boards and initialise them... */ 82 static int hplance_init_one(struct dio_dev *d, const struct dio_device_id *ent) 83 { 84 struct net_device *dev; 85 int err; 86 > 87 dev = devm_alloc_etherdev(sizeof(&d->dev, struct hplance_private)); 88 if (!dev) 89 return -ENOMEM; 90 91 if (!devm_request_mem_region(&d->dev, dio_resource_start(d), 92 dio_resource_len(d), d->name)) 93 return -EBUSY; 94 95 hplance_init(dev, d); 96 err = devm_register_netdev(&d->dev, dev); 97 if (err) 98 return err; 99 100 dio_set_drvdata(d, dev); 101 102 printk(KERN_INFO "%s: %s; select code %d, addr %pM, irq %d\n", 103 dev->name, d->name, d->scode, dev->dev_addr, d->ipl); 104 105 return 0; 106 } 107
diff --git a/drivers/net/ethernet/amd/hplance.c b/drivers/net/ethernet/amd/hplance.c index df42294530cb..2ebf7cc9ab21 100644 --- a/drivers/net/ethernet/amd/hplance.c +++ b/drivers/net/ethernet/amd/hplance.c @@ -49,7 +49,6 @@ struct hplance_private { */ static int hplance_init_one(struct dio_dev *d, const struct dio_device_id *ent); static void hplance_init(struct net_device *dev, struct dio_dev *d); -static void hplance_remove_one(struct dio_dev *d); static void hplance_writerap(void *priv, unsigned short value); static void hplance_writerdp(void *priv, unsigned short value); static unsigned short hplance_readrdp(void *priv); @@ -65,7 +64,6 @@ static struct dio_driver hplance_driver = { .name = "hplance", .id_table = hplance_dio_tbl, .probe = hplance_init_one, - .remove = hplance_remove_one, }; static const struct net_device_ops hplance_netdev_ops = { @@ -84,21 +82,20 @@ static const struct net_device_ops hplance_netdev_ops = { static int hplance_init_one(struct dio_dev *d, const struct dio_device_id *ent) { struct net_device *dev; - int err = -ENOMEM; + int err; - dev = alloc_etherdev(sizeof(struct hplance_private)); + dev = devm_alloc_etherdev(sizeof(&d->dev, struct hplance_private)); if (!dev) - goto out; + return -ENOMEM; - err = -EBUSY; - if (!request_mem_region(dio_resource_start(d), + if (!devm_request_mem_region(&d->dev, dio_resource_start(d), dio_resource_len(d), d->name)) - goto out_free_netdev; + return -EBUSY; hplance_init(dev, d); - err = register_netdev(dev); + err = devm_register_netdev(&d->dev, dev); if (err) - goto out_release_mem_region; + return err; dio_set_drvdata(d, dev); @@ -106,22 +103,6 @@ static int hplance_init_one(struct dio_dev *d, const struct dio_device_id *ent) dev->name, d->name, d->scode, dev->dev_addr, d->ipl); return 0; - - out_release_mem_region: - release_mem_region(dio_resource_start(d), dio_resource_len(d)); - out_free_netdev: - free_netdev(dev); - out: - return err; -} - -static void hplance_remove_one(struct dio_dev *d) -{ - struct net_device *dev = dio_get_drvdata(d); - - unregister_netdev(dev); - release_mem_region(dio_resource_start(d), dio_resource_len(d)); - free_netdev(dev); } /* Initialise a single lance board at the given DIO device */
Allows removal of the remove function as devm can handle the freeing of these resources. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- drivers/net/ethernet/amd/hplance.c | 33 +++++++----------------------- 1 file changed, 7 insertions(+), 26 deletions(-)