All of lore.kernel.org
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?J=CE=B5an?= Sacren <sakiwit@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next-queue v2 6/6] i40e: fix unconditional execution of cpu_to_le16()
Date: Tue, 13 Oct 2015 01:06:32 -0600	[thread overview]
Message-ID: <1444719992-301-6-git-send-email-sakiwit@gmail.com> (raw)
In-Reply-To: <1444719992-301-1-git-send-email-sakiwit@gmail.com>

From: Jean Sacren <sakiwit@gmail.com>

The commit 3092e5e4cc79 ("i40e: add little endian conversion for
checksum") fixed the checksum bug on big-endian architecture.

But we should not execute cpu_to_le16() unconditionally. Thus, put
cpu_to_le16() under certain condition.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
---
v2: Update patch serial number and add CC to Paul M Stillwell Jr.

 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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

  parent reply	other threads:[~2015-10-13  7:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13  7:06 [Intel-wired-lan] [next-queue v2 1/6] i40evf: add missing kernel-doc argument =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-10-13  7:06 ` [Intel-wired-lan] [next-queue v2 2/6] i40e: " =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-10-13 16:36   ` Bowers, AndrewX
2015-10-13 16:50   ` Jesse Brandeburg
2015-10-13  7:06 ` [Intel-wired-lan] [next-queue v2 3/6] i40e: clean up the entire function exit path =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-10-13 16:39   ` Bowers, AndrewX
2015-10-13 16:59   ` Jesse Brandeburg
2015-10-13 17:41     ` Tantilov, Emil S
2015-10-13  7:06 ` [Intel-wired-lan] [next-queue v2 4/6] i40evf: clean up local variable initialization =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-10-13 16:41   ` Bowers, AndrewX
2015-10-13  7:06 ` [Intel-wired-lan] [next-queue v2 5/6] i40e: " =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-10-13 16:43   ` Bowers, AndrewX
2015-10-13  7:06 ` =?unknown-8bit?q?J=CE=B5an?= Sacren [this message]
2015-10-13 16:45   ` [Intel-wired-lan] [next-queue v2 6/6] i40e: fix unconditional execution of cpu_to_le16() Bowers, AndrewX
2015-10-13 16:34 ` [Intel-wired-lan] [next-queue v2 1/6] i40evf: add missing kernel-doc argument Bowers, AndrewX
2015-10-13 16:49 ` Jesse Brandeburg

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=1444719992-301-6-git-send-email-sakiwit@gmail.com \
    --to=sakiwit@gmail.com \
    --cc=intel-wired-lan@osuosl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.