[dpdk-dev] net/bnx2x: fix icc build error

Message ID 20160930144515.1770-1-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Ferruh Yigit Sept. 30, 2016, 2:45 p.m. UTC
  When bnx2x debug config enabled, icc (ICC) 17.0.0 20160721
gives the following compilation error:

.../drivers/net/bnx2x/elink.c(6682):
error #3656: variable "fw_ver1" may be used before its value is set
	PMD_DRV_LOG(DEBUG,
	^

According logic in the code, this error is a false positive,
but since this is not in the fast path, fixing compiler error by
assigning initial value to variable.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/bnx2x/elink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Oct. 17, 2016, 12:11 p.m. UTC | #1
On 9/30/2016 3:45 PM, Ferruh Yigit wrote:
> When bnx2x debug config enabled, icc (ICC) 17.0.0 20160721
> gives the following compilation error:
> 
> .../drivers/net/bnx2x/elink.c(6682):
> error #3656: variable "fw_ver1" may be used before its value is set
> 	PMD_DRV_LOG(DEBUG,
> 	^
> 
> According logic in the code, this error is a false positive,
> but since this is not in the fast path, fixing compiler error by
> assigning initial value to variable.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  drivers/net/bnx2x/elink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bnx2x/elink.c b/drivers/net/bnx2x/elink.c
> index 149cc97..d9a72f0 100644
> --- a/drivers/net/bnx2x/elink.c
> +++ b/drivers/net/bnx2x/elink.c
> @@ -6645,7 +6645,7 @@ static elink_status_t elink_8073_8727_external_rom_boot(struct bnx2x_softc *sc,
>  							uint8_t port)
>  {
>  	uint32_t count = 0;
> -	uint16_t fw_ver1, fw_msgout;
> +	uint16_t fw_ver1 = 0, fw_msgout;
>  	elink_status_t rc = ELINK_STATUS_OK;
>  
>  	/* Boot port from external ROM  */
> 

Since this is an compilation fix, I believe it is good to have this in
the release, can you please review the patch?

Thanks,
ferruh
  
Mody, Rasesh Oct. 17, 2016, 6:04 p.m. UTC | #2
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Monday, October 17, 2016 5:12 AM
> 
> On 9/30/2016 3:45 PM, Ferruh Yigit wrote:
> > When bnx2x debug config enabled, icc (ICC) 17.0.0 20160721 gives the
> > following compilation error:
> >
> > .../drivers/net/bnx2x/elink.c(6682):
> > error #3656: variable "fw_ver1" may be used before its value is set
> > 	PMD_DRV_LOG(DEBUG,
> > 	^
> >
> > According logic in the code, this error is a false positive, but since
> > this is not in the fast path, fixing compiler error by assigning
> > initial value to variable.
> >
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > ---
> >  drivers/net/bnx2x/elink.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bnx2x/elink.c b/drivers/net/bnx2x/elink.c
> > index 149cc97..d9a72f0 100644
> > --- a/drivers/net/bnx2x/elink.c
> > +++ b/drivers/net/bnx2x/elink.c
> > @@ -6645,7 +6645,7 @@ static elink_status_t
> elink_8073_8727_external_rom_boot(struct bnx2x_softc *sc,
> >  							uint8_t port)
> >  {
> >  	uint32_t count = 0;
> > -	uint16_t fw_ver1, fw_msgout;
> > +	uint16_t fw_ver1 = 0, fw_msgout;
> >  	elink_status_t rc = ELINK_STATUS_OK;
> >
> >  	/* Boot port from external ROM  */
> >
> 
> Since this is an compilation fix, I believe it is good to have this in the release,
> can you please review the patch?

Thanks!

Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
 
> Thanks,
> ferruh
  
Bruce Richardson Oct. 19, 2016, 9:24 a.m. UTC | #3
On Mon, Oct 17, 2016 at 06:04:32PM +0000, Mody, Rasesh wrote:
> > From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> > Sent: Monday, October 17, 2016 5:12 AM
> > 
> > On 9/30/2016 3:45 PM, Ferruh Yigit wrote:
> > > When bnx2x debug config enabled, icc (ICC) 17.0.0 20160721 gives the
> > > following compilation error:
> > >
> > > .../drivers/net/bnx2x/elink.c(6682):
> > > error #3656: variable "fw_ver1" may be used before its value is set
> > > 	PMD_DRV_LOG(DEBUG,
> > > 	^
> > >
> > > According logic in the code, this error is a false positive, but since
> > > this is not in the fast path, fixing compiler error by assigning
> > > initial value to variable.
> > >
> > > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
<snip>
> 
> > Since this is an compilation fix, I believe it is good to have this in the release,
> > can you please review the patch?
> 
> Thanks!
> 
> Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
>  
Applied to dpdk-next-net/rel_16_11

/Bruce
  

Patch

diff --git a/drivers/net/bnx2x/elink.c b/drivers/net/bnx2x/elink.c
index 149cc97..d9a72f0 100644
--- a/drivers/net/bnx2x/elink.c
+++ b/drivers/net/bnx2x/elink.c
@@ -6645,7 +6645,7 @@  static elink_status_t elink_8073_8727_external_rom_boot(struct bnx2x_softc *sc,
 							uint8_t port)
 {
 	uint32_t count = 0;
-	uint16_t fw_ver1, fw_msgout;
+	uint16_t fw_ver1 = 0, fw_msgout;
 	elink_status_t rc = ELINK_STATUS_OK;
 
 	/* Boot port from external ROM  */