patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Zhang, Tianfei" <tianfei.zhang@intel.com>
To: "Xu, Rosen" <rosen.xu@intel.com>
Cc: "Pei, Andy" <andy.pei@intel.com>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-stable] [PATCH] raw/ifpga: fix logically dead code
Date: Fri, 17 May 2019 05:49:48 +0000	[thread overview]
Message-ID: <BA6F50564D52C24884F9840E07E32DEC4E022B91@CDSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <0E78D399C70DA940A335608C6ED296D73A753123@SHSMSX104.ccr.corp.intel.com>



> -----Original Message-----
> From: Xu, Rosen
> Sent: Friday, May 17, 2019 12:43 PM
> To: Zhang, Tianfei <tianfei.zhang@intel.com>
> Cc: Pei, Andy <andy.pei@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH] raw/ifpga: fix logically dead code
> 
> Hi Tianfei,
> 
> > -----Original Message-----
> > From: Zhang, Tianfei
> > Sent: Friday, May 17, 2019 19:25
> > To: Xu, Rosen <rosen.xu@intel.com>
> > Cc: Pei, Andy <andy.pei@intel.com>; Zhang, Tianfei
> > <tianfei.zhang@intel.com>; stable@dpdk.org; Zhang
> > Subject: [PATCH] raw/ifpga: fix logically dead code
> >
> > add temporary variable in max10_reg_write().
> >
> > Coverity issue: 337927
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Zhang, Tianfei <tianfei.zhang@intel.com>
> > ---
> >  drivers/raw/ifpga_rawdev/base/opae_intel_max10.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
> > b/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
> > index f354ee4b6..3ff6575d7 100644
> > --- a/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
> > +++ b/drivers/raw/ifpga_rawdev/base/opae_intel_max10.c
> > @@ -17,11 +17,13 @@ int max10_reg_read(unsigned int reg, unsigned int
> > *val)
> >
> >  int max10_reg_write(unsigned int reg, unsigned int val)  {
> 
> If you don't need to modify val, why use const?

I don't think it is necessary to use const for val, val is quiet simple and no one will modify it.
> 
> > +	unsigned int tmp = val;
> > +
> >  	if (!g_max10)
> >  		return -ENODEV;
> >
> >  	return spi_transaction_write(g_max10->spi_tran_dev,
> > -			reg, 4, (unsigned char *)&val);
> > +			reg, 4, (unsigned char *)&tmp);
> >  }
> >
> >  struct intel_max10_device *
> > @@ -57,7 +59,7 @@ intel_max10_device_probe(struct altera_spi_device
> > *spi,
> >
> >  	/* set PKVL Polling manually in BBS */
> >  	ret = max10_reg_write(PKVL_POLLING_CTRL, 0x3);
> > -	if (ret) {
> > +	if (ret != 0) {
> >  		dev_err(dev, "%s set PKVL polling fail\n", __func__);
> >  		goto spi_tran_fail;
> >  	}
> > --
> > 2.17.1


      reply	other threads:[~2019-05-17  5:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 11:25 Zhang, Tianfei
2019-05-17  4:43 ` Xu, Rosen
2019-05-17  5:49   ` Zhang, Tianfei [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=BA6F50564D52C24884F9840E07E32DEC4E022B91@CDSMSX104.ccr.corp.intel.com \
    --to=tianfei.zhang@intel.com \
    --cc=andy.pei@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=stable@dpdk.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).