From: Johannes Berg Date: Thu, 28 Mar 2024 07:27:50 +0000 (+0100) Subject: netdevice: add DEFINE_FREE() for dev_put X-Git-Tag: v6.10-rc1~153^2~375 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b1f81b9a535b48b2c9ca460720a2bc73fd2001de;p=thirdparty%2Flinux.git netdevice: add DEFINE_FREE() for dev_put 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 Reviewed-by: Simon Horman Signed-off-by: David S. Miller --- diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7d12b5a9380f4..0c198620ac93e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4097,6 +4097,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,