[2/2] net/bnxt: fix uninitialized variable error

Message ID 20200505191738.58219-3-ajit.khaparde@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ajit Khaparde
Headers
Series fix coverity reported issues |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot warning Travis build: failed
ci/Intel-compilation success Compilation OK

Commit Message

Ajit Khaparde May 5, 2020, 7:17 p.m. UTC
  Fix uninitialized variable error reported by coverity.

Fixes: d33b68154fa4 ("net/bnxt: add tf_core table scope support")
Coverity issue: 357771

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit May 6, 2020, 9:13 a.m. UTC | #1
On 5/5/2020 8:17 PM, Ajit Khaparde wrote:
> Fix uninitialized variable error reported by coverity.
> 
> Fixes: d33b68154fa4 ("net/bnxt: add tf_core table scope support")

The commit id and the patch title doesn't exist in next-net (also not int
next-net-brcm), I guess you mean [1] but the updated function below
('tf_em_ctx_reg()') even not exist in that commit.

Can you please check the tag again?

[1] net/bnxt: support TruFlow core table scope

> Coverity issue: 357771
> 
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
> Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
> ---
>  drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
> index 93f387e86..d900c9c09 100644
> --- a/drivers/net/bnxt/tf_core/tf_tbl.c
> +++ b/drivers/net/bnxt/tf_core/tf_tbl.c
> @@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
>  {
>  	struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
>  	struct tf_em_table *tbl;
> -	int rc;
> +	int rc = 0;
>  	int i;
>  
>  	for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
>
  
Ajit Khaparde May 7, 2020, 6:55 p.m. UTC | #2
On Wed, May 6, 2020 at 2:14 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 5/5/2020 8:17 PM, Ajit Khaparde wrote:
> > Fix uninitialized variable error reported by coverity.
> >
> > Fixes: d33b68154fa4 ("net/bnxt: add tf_core table scope support")
>
> The commit id and the patch title doesn't exist in next-net (also not int
> next-net-brcm), I guess you mean [1] but the updated function below
> ('tf_em_ctx_reg()') even not exist in that commit.
>
> Can you please check the tag again?
>
> [1] net/bnxt: support TruFlow core table scope
>
Yes [1] is the correct commit.
dba3ca8b304f ("net/bnxt: support TruFlow core table scope").


>
> > Coverity issue: 357771
> >
> > Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> > Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
> > Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
> > ---
> >  drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c
> b/drivers/net/bnxt/tf_core/tf_tbl.c
> > index 93f387e86..d900c9c09 100644
> > --- a/drivers/net/bnxt/tf_core/tf_tbl.c
> > +++ b/drivers/net/bnxt/tf_core/tf_tbl.c
> > @@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
> >  {
> >       struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
> >       struct tf_em_table *tbl;
> > -     int rc;
> > +     int rc = 0;
> >       int i;
> >
> >       for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
> >
>
>
  
Ferruh Yigit May 7, 2020, 9:15 p.m. UTC | #3
On 5/7/2020 7:55 PM, Ajit Khaparde wrote:
> 
> 
> On Wed, May 6, 2020 at 2:14 AM Ferruh Yigit <ferruh.yigit@intel.com
> <mailto:ferruh.yigit@intel.com>> wrote:
> 
>     On 5/5/2020 8:17 PM, Ajit Khaparde wrote:
>     > Fix uninitialized variable error reported by coverity.
>     >
>     > Fixes: d33b68154fa4 ("net/bnxt: add tf_core table scope support")
> 
>     The commit id and the patch title doesn't exist in next-net (also not int
>     next-net-brcm), I guess you mean [1] but the updated function below
>     ('tf_em_ctx_reg()') even not exist in that commit.
> 
>     Can you please check the tag again?
> 
>     [1] net/bnxt: support TruFlow core table scope
> 
> Yes [1] is the correct commit.
> dba3ca8b304f("net/bnxt: support TruFlow core table scope").

Using following after offline discussion:
Fixes: 69c410b8448d ("net/bnxt: support EM/EEM")

>  
> 
> 
>     > Coverity issue: 357771
>     >
>     > Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com
>     <mailto:ajit.khaparde@broadcom.com>>
>     > Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com
>     <mailto:somnath.kotur@broadcom.com>>
>     > Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com
>     <mailto:stuart.schacher@broadcom.com>>
>     > ---
>     >  drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
>     >  1 file changed, 1 insertion(+), 1 deletion(-)
>     >
>     > diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c
>     b/drivers/net/bnxt/tf_core/tf_tbl.c
>     > index 93f387e86..d900c9c09 100644
>     > --- a/drivers/net/bnxt/tf_core/tf_tbl.c
>     > +++ b/drivers/net/bnxt/tf_core/tf_tbl.c
>     > @@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
>     >  {
>     >       struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
>     >       struct tf_em_table *tbl;
>     > -     int rc;
>     > +     int rc = 0;
>     >       int i;
>     > 
>     >       for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
>     >
>
  

Patch

diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
index 93f387e86..d900c9c09 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl.c
@@ -539,7 +539,7 @@  tf_em_ctx_reg(struct tf *tfp,
 {
 	struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
 	struct tf_em_table *tbl;
-	int rc;
+	int rc = 0;
 	int i;
 
 	for (i = KEY0_TABLE; i < MAX_TABLE; i++) {