Patchwork [net-next] tun: remove unnecessary check in tun_flow_update

login
register
mail settings
Submitter Li RongQing
Date Dec. 6, 2018, 8:28 a.m.
Message ID <1544084891-3015-1-git-send-email-lirongqing@baidu.com>
Download mbox | patch
Permalink /patch/673859/
State New
Headers show

Comments

Li RongQing - Dec. 6, 2018, 8:28 a.m.
caller has guaranted that rxhash is not zero

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/net/tun.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Jason Wang - Dec. 6, 2018, 9:57 a.m.
On 2018/12/6 下午4:28, Li RongQing wrote:
> caller has guaranted that rxhash is not zero
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>   drivers/net/tun.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index d0745dc81976..6760b86547df 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -529,10 +529,7 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash,
>   	unsigned long delay = tun->ageing_time;
>   	u16 queue_index = tfile->queue_index;
>   
> -	if (!rxhash)
> -		return;
> -	else
> -		head = &tun->flows[tun_hashfn(rxhash)];
> +	head = &tun->flows[tun_hashfn(rxhash)];
>   
>   	rcu_read_lock();
>   


Acked-by: Jason Wang <jasowang@redhat.com>
David Miller - Dec. 6, 2018, 8:16 p.m.
From: Li RongQing <lirongqing@baidu.com>
Date: Thu,  6 Dec 2018 16:28:11 +0800

> caller has guaranted that rxhash is not zero
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied.

Patch

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d0745dc81976..6760b86547df 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -529,10 +529,7 @@  static void tun_flow_update(struct tun_struct *tun, u32 rxhash,
 	unsigned long delay = tun->ageing_time;
 	u16 queue_index = tfile->queue_index;
 
-	if (!rxhash)
-		return;
-	else
-		head = &tun->flows[tun_hashfn(rxhash)];
+	head = &tun->flows[tun_hashfn(rxhash)];
 
 	rcu_read_lock();