i40e/i40evf: cleanup i40e_update_nvm_checksum()
diff mbox series

Message ID 20190509101051.GB7024@mwanda
State Under Review
Delegated to: Jeff Kirsher
Headers show
Series
  • i40e/i40evf: cleanup i40e_update_nvm_checksum()
Related show

Commit Message

Dan Carpenter May 9, 2019, 10:10 a.m. UTC
Smatch complains that we use 'checksum' when it's uninitialized.

    drivers/net/ethernet/intel/i40e/i40e_nvm.c:581 i40e_update_nvm_checksum()
    error: uninitialized symbol 'checksum'.

This is true, but it harmless because we don't use it again.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Bowers, AndrewX May 17, 2019, 10:34 p.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of Dan Carpenter
> Sent: Thursday, May 9, 2019 3:11 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>
> Cc: kernel-janitors@vger.kernel.org; intel-wired-lan@lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH] i40e/i40evf: cleanup
> i40e_update_nvm_checksum()
> 
> Smatch complains that we use 'checksum' when it's uninitialized.
> 
>     drivers/net/ethernet/intel/i40e/i40e_nvm.c:581
> i40e_update_nvm_checksum()
>     error: uninitialized symbol 'checksum'.
> 
> This is true, but it harmless because we don't use it again.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_nvm.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

kernel-janitors@vger.kernel.org; intel-wired-lan@lists.osuosl.org
Bowers, AndrewX May 22, 2019, 10:14 p.m. UTC | #2
> -----Original Message-----
> From: Bowers, AndrewX
> Sent: Friday, May 17, 2019 3:34 PM
> To: kernel-janitors@vger.kernel.org; intel-wired-lan@lists.osuosl.org
> Subject: RE: [Intel-wired-lan] [PATCH] i40e/i40evf: cleanup
> i40e_update_nvm_checksum()
> 
> > -----Original Message-----
> > From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> > Behalf Of Dan Carpenter
> > Sent: Thursday, May 9, 2019 3:11 AM
> > To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>
> > Cc: kernel-janitors@vger.kernel.org; intel-wired-lan@lists.osuosl.org
> > Subject: [Intel-wired-lan] [PATCH] i40e/i40evf: cleanup
> > i40e_update_nvm_checksum()
> >
> > Smatch complains that we use 'checksum' when it's uninitialized.
> >
> >     drivers/net/ethernet/intel/i40e/i40e_nvm.c:581
> > i40e_update_nvm_checksum()
> >     error: uninitialized symbol 'checksum'.
> >
> > This is true, but it harmless because we don't use it again.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/net/ethernet/intel/i40e/i40e_nvm.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> kernel-janitors@vger.kernel.org; intel-wired-lan@lists.osuosl.org

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>

Helps to paste in my "Tested by" and not the addresses I'm sending it to...

Patch
diff mbox series

diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index c508b75c3c09..a60ab9d48065 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -578,12 +578,11 @@  i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw)
 	__le16 le_sum;
 
 	ret_code = i40e_calc_nvm_checksum(hw, &checksum);
+	if (ret_code)
+		return ret_code;
 	le_sum = cpu_to_le16(checksum);
-	if (!ret_code)
-		ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
-					     1, &le_sum, true);
-
-	return ret_code;
+	return i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD, 1,
+				 &le_sum, true);
 }
 
 /**