Message ID | 20240328082748.4f7e1895ed81.I1515fdc09a9f39fdbc26558556dd65a2cb03576a@changeid (mailing list archive) |
---|---|
State | Accepted |
Commit | b1f81b9a535b48b2c9ca460720a2bc73fd2001de |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v2,1/2] rtnetlink: add guard for RTNL | expand |
On Thu, Mar 28, 2024 at 08:27:50AM +0100, Johannes Berg wrote: > From: Johannes Berg <johannes.berg@intel.com> > > For short netdev holds within a function there are still a lot of > users of dev_put() rather than netdev_put(). Add DEFINE_FREE() to > allow making those safer. > > Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Simon Horman <horms@kernel.org>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cb37817d6382..f6c0d731fa35 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4127,6 +4127,8 @@ static inline void dev_put(struct net_device *dev) netdev_put(dev, NULL); } +DEFINE_FREE(dev_put, struct net_device *, if (_T) dev_put(_T)) + static inline void netdev_ref_replace(struct net_device *odev, struct net_device *ndev, netdevice_tracker *tracker,