linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chien Tin Tung <chien.tin.tung@intel.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>,
	Faisal Latif <faisal.latif@intel.com>,
	Shiraz Saleem <shiraz.saleem@intel.com>,
	Doug Ledford <dledford@redhat.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [infiniband-hw-i40iw] question about identical code for different branches
Date: Thu, 18 May 2017 10:03:17 -0500	[thread overview]
Message-ID: <20170518150317.GA10396@ctung-MOBL3.amr.corp.intel.com> (raw)
In-Reply-To: <20170518050029.GY3616@mtr-leonro.local>

 Thu, May 18, 2017 at 08:00:29AM +0300, Leon Romanovsky wrote:
> On Wed, May 17, 2017 at 05:06:54PM -0500, Gustavo A. R. Silva wrote:
> >
> > Hello everybody,
> >
> > While looking into Coverity ID 1362263 I ran into the following piece of
> > code at drivers/infiniband/hw/i40iw/i40iw_virtchnl.c:445:
> >
> > 445        if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) {
> > 446                if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0)
> > 447                        vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> > 448                else
> > 449                        vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> > 450                return I40IW_SUCCESS;
> > 451        }
> >
> > The issue is that lines of code 447 and 449 are identical for different
> > branches.
> >
> > My question here is if one of the branches should be modified, or the entire
> > _if_ statement replaced?
> >
> > Maybe a patch like the following could be applied:
> 
> It looks like that you can replace I40IW_VCHNL_OP_GET_VER_V0 with
> I40IW_VCHNL_OP_GET_VER and get rid of all places with
> I40IW_VCHNL_OP_GET_VER_V0.

No. I40IW_VCHNL_OP_GET_VER is iw_op_code and I40IW_VCHNL_OP_GET_VER_V0 is
iw_op_ver two different things.

Chien

  reply	other threads:[~2017-05-18 15:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 22:06 [infiniband-hw-i40iw] question about identical code for different branches Gustavo A. R. Silva
2017-05-18  5:00 ` Leon Romanovsky
2017-05-18 15:03   ` Chien Tin Tung [this message]
2017-05-18  6:00 ` Yuval Shaia
2017-05-18 14:35 ` Saleem, Shiraz
2017-05-18 17:54   ` Gustavo A. R. Silva
2017-05-18 18:11     ` [PATCH] infiniband: hw: i40iw: fix duplicated " Gustavo A. R. Silva
2017-05-19 16:59       ` Shiraz Saleem
2017-06-01 22:27       ` Doug Ledford

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=20170518150317.GA10396@ctung-MOBL3.amr.corp.intel.com \
    --to=chien.tin.tung@intel.com \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.com \
    --cc=garsilva@embeddedor.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.com \
    --cc=shiraz.saleem@intel.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).