bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] xdp: move the if dev statements to the first
@ 2021-12-17  9:25 Yajun Deng
  2021-12-18 12:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Yajun Deng @ 2021-12-17  9:25 UTC (permalink / raw)
  To: ast, daniel, davem, kuba, hawk, john.fastabend
  Cc: netdev, bpf, linux-kernel, Yajun Deng

The xdp_rxq_info_unreg() called by xdp_rxq_info_reg() is meaningless when
dev is NULL, so move the if dev statements to the first.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 net/core/xdp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/core/xdp.c b/net/core/xdp.c
index 5ddc29f29bad..7fe1df85f505 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -159,6 +159,11 @@ static void xdp_rxq_info_init(struct xdp_rxq_info *xdp_rxq)
 int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
 		     struct net_device *dev, u32 queue_index, unsigned int napi_id)
 {
+	if (!dev) {
+		WARN(1, "Missing net_device from driver");
+		return -ENODEV;
+	}
+
 	if (xdp_rxq->reg_state == REG_STATE_UNUSED) {
 		WARN(1, "Driver promised not to register this");
 		return -EINVAL;
@@ -169,11 +174,6 @@ int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
 		xdp_rxq_info_unreg(xdp_rxq);
 	}
 
-	if (!dev) {
-		WARN(1, "Missing net_device from driver");
-		return -ENODEV;
-	}
-
 	/* State either UNREGISTERED or NEW */
 	xdp_rxq_info_init(xdp_rxq);
 	xdp_rxq->dev = dev;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] xdp: move the if dev statements to the first
  2021-12-17  9:25 [PATCH net-next] xdp: move the if dev statements to the first Yajun Deng
@ 2021-12-18 12:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-18 12:40 UTC (permalink / raw)
  To: Yajun Deng
  Cc: ast, daniel, davem, kuba, hawk, john.fastabend, netdev, bpf,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 17 Dec 2021 17:25:45 +0800 you wrote:
> The xdp_rxq_info_unreg() called by xdp_rxq_info_reg() is meaningless when
> dev is NULL, so move the if dev statements to the first.
> 
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
>  net/core/xdp.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Here is the summary with links:
  - [net-next] xdp: move the if dev statements to the first
    https://git.kernel.org/netdev/net-next/c/f85b244ee395

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-18 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17  9:25 [PATCH net-next] xdp: move the if dev statements to the first Yajun Deng
2021-12-18 12:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).