mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
netpoll: allocate netdev tracker right away
Commit 5fa5ae6058
("netpoll: add net device refcount tracker to struct netpoll")
was part of one of the initial netdev tracker introduction patches.
It added an explicit netdev_tracker_alloc() for netpoll, presumably
because the flow of the function is somewhat odd.
After most of the core networking stack was converted to use
the tracking hold() variants, netpoll's call to old dev_hold()
stands out a bit.
np is allocated by the caller and ready to use, we can use
netdev_hold() here, even tho np->ndev will only be set to
ndev inside __netpoll_setup().
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
70f7457ad6
commit
48eed027d3
@ -690,7 +690,7 @@ int netpoll_setup(struct netpoll *np)
|
|||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
dev_hold(ndev);
|
netdev_hold(ndev, &np->dev_tracker, GFP_KERNEL);
|
||||||
|
|
||||||
if (netdev_master_upper_dev_get(ndev)) {
|
if (netdev_master_upper_dev_get(ndev)) {
|
||||||
np_err(np, "%s is a slave device, aborting\n", np->dev_name);
|
np_err(np, "%s is a slave device, aborting\n", np->dev_name);
|
||||||
@ -783,12 +783,11 @@ put_noaddr:
|
|||||||
err = __netpoll_setup(np, ndev);
|
err = __netpoll_setup(np, ndev);
|
||||||
if (err)
|
if (err)
|
||||||
goto put;
|
goto put;
|
||||||
netdev_tracker_alloc(ndev, &np->dev_tracker, GFP_KERNEL);
|
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
put:
|
put:
|
||||||
dev_put(ndev);
|
netdev_put(ndev, &np->dev_tracker);
|
||||||
unlock:
|
unlock:
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return err;
|
return err;
|
||||||
|
Loading…
Reference in New Issue
Block a user