Re: [PATCH net-next v3 1/3] net: document return value of dev_getbyhwaddr_rcu()

From: Kuniyuki Iwashima
Date: Thu Feb 13 2025 - 02:37:19 EST


From: Breno Leitao <leitao@xxxxxxxxxx>
Date: Wed, 12 Feb 2025 09:47:24 -0800
> diff --git a/net/core/dev.c b/net/core/dev.c
> index d5ab9a4b318ea4926c200ef20dae01eaafa18c6b..0b3480a125fcaa6f036ddf219c29fa362ea0cb29 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1134,8 +1134,8 @@ int netdev_get_name(struct net *net, char *name, int ifindex)
> * The returned device has not had its ref count increased
> * and the caller must therefore be careful about locking
> *
> + * Return: pointer to the net_device, or NULL if not found
> */

I noticed here we still mention RTNL and it should be removed.

Could you update the comment like this to remove RTNL and fix
mis-aligned notes ?

---8<---
diff --git a/net/core/dev.c b/net/core/dev.c
index d5ab9a4b318e..c0d6017a3840 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1123,17 +1123,17 @@ int netdev_get_name(struct net *net, char *name, int ifindex)
}

/**
- * dev_getbyhwaddr_rcu - find a device by its hardware address
- * @net: the applicable net namespace
- * @type: media type of device
- * @ha: hardware address
+ * dev_getbyhwaddr_rcu - find a device by its hardware address
+ * @net: the applicable net namespace
+ * @type: media type of device
+ * @ha: hardware address
*
- * Search for an interface by MAC address. Returns NULL if the device
- * is not found or a pointer to the device.
- * The caller must hold RCU or RTNL.
- * The returned device has not had its ref count increased
- * and the caller must therefore be careful about locking
+ * Search for an interface by MAC address. The returned device has
+ * not had its ref count increased and the caller must therefore be
+ * careful about locking
*
+ * Context: The caller must hold RCU.
+ * Return: pointer to the net_device, or NULL if not found
*/

struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
---8<---

Thanks!