netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin Ian King <colin.king@canonical.com>
Cc: "Jakub Kicinski" <jakub.kicinski@netronome.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"David S . Miller" <davem@davemloft.net>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	"Magnus Karlsson" <magnus.karlsson@intel.com>,
	netdev@vger.kernel.org, xdp-newbies@vger.kernel.org,
	bpf@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] bpf: remove redundant assignment to err
Date: Thu, 6 Jun 2019 13:44:28 +0300	[thread overview]
Message-ID: <20190606104428.GK31203@kadam> (raw)
In-Reply-To: <e351d18c-21cd-6617-2a59-31a48be54b7e@canonical.com>

On Mon, Jun 03, 2019 at 07:07:20PM +0100, Colin Ian King wrote:
> On 03/06/2019 18:49, Jakub Kicinski wrote:
> > On Mon, 3 Jun 2019 18:39:16 +0100, Colin Ian King wrote:
> >> On 03/06/2019 18:21, Jakub Kicinski wrote:
> >>> On Mon,  3 Jun 2019 18:02:47 +0100, Colin King wrote:  
> >>>> From: Colin Ian King <colin.king@canonical.com>
> >>>>
> >>>> The variable err is assigned with the value -EINVAL that is never
> >>>> read and it is re-assigned a new value later on.  The assignment is
> >>>> redundant and can be removed.
> >>>>
> >>>> Addresses-Coverity: ("Unused value")
> >>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >>>> ---
> >>>>  kernel/bpf/devmap.c | 2 +-
> >>>>  kernel/bpf/xskmap.c | 2 +-
> >>>>  2 files changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> >>>> index 5ae7cce5ef16..a76cc6412fc4 100644
> >>>> --- a/kernel/bpf/devmap.c
> >>>> +++ b/kernel/bpf/devmap.c
> >>>> @@ -88,7 +88,7 @@ static u64 dev_map_bitmap_size(const union bpf_attr *attr)
> >>>>  static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
> >>>>  {
> >>>>  	struct bpf_dtab *dtab;
> >>>> -	int err = -EINVAL;
> >>>> +	int err;
> >>>>  	u64 cost;  
> >>>
> >>> Perhaps keep the variables ordered longest to shortest?  
> >>
> >> Is that a required coding standard?
> > 
> > For networking code, yes.  Just look around the files you're changing
> > and see for yourself.
> 
> Ah, informal coding standards. Great. Won't this end up with more diff
> churn?

Everyone knows that netdev uses reverse Christmas tree declarations...

regards,
dan carpenter


      reply	other threads:[~2019-06-06 10:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 17:02 [PATCH][next] bpf: remove redundant assignment to err Colin King
2019-06-03 17:21 ` Jakub Kicinski
2019-06-03 17:39   ` Colin Ian King
2019-06-03 17:49     ` Jakub Kicinski
2019-06-03 18:07       ` Colin Ian King
2019-06-06 10:44         ` Dan Carpenter [this message]

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=20190606104428.GK31203@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=colin.king@canonical.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=xdp-newbies@vger.kernel.org \
    /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).