netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] net/sched: remove redundant null check on head
Date: Wed, 03 May 2017 16:21:15 +0200	[thread overview]
Message-ID: <5909E75B.30305@bfs.de> (raw)
In-Reply-To: <20170503135040.32023-1-colin.king@canonical.com>



Am 03.05.2017 15:50, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> head is previously null checked and so the 2nd null check on head
> is redundant and therefore can be removed.
> 
> Detected by CoverityScan, CID#1399505 ("Logically dead code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  net/sched/cls_matchall.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
> index 2efb36c08f2a..dee469fed967 100644
> --- a/net/sched/cls_matchall.c
> +++ b/net/sched/cls_matchall.c
> @@ -203,8 +203,7 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,
>  
>  	*arg = (unsigned long) head;
>  	rcu_assign_pointer(tp->root, new);
> -	if (head)
> -		call_rcu(&head->rcu, mall_destroy_rcu);
> +	call_rcu(&head->rcu, mall_destroy_rcu);
>  	return 0;
>  
>  err_replace_hw_filter:


if someone cares .. the err=0 in the the line above the patch is also useless
because err is never used again. Merging both if will save 1 indent level.

 err = mall_replace_hw_filter(tp, new, (unsigned long) new);
 if (err && tc_skip_sw(flags) )
	goto errout;


just my impression,
re
 wh

  parent reply	other threads:[~2017-05-03 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 13:50 [PATCH] net/sched: remove redundant null check on head Colin King
2017-05-03 14:15 ` Jiri Pirko
2017-05-03 14:21 ` walter harms [this message]
2017-05-03 15:12   ` Jiri Pirko
2017-05-04 15:01 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5909E75B.30305@bfs.de \
    --to=wharms@bfs.de \
    --cc=colin.king@canonical.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).