Skip to contentSkip to conversation

i40e: Two trivial fixes for 09f79fd49d94

PATCH In review Stefano Brivio 3 participants 7 messages Sep 6, 2017 – Sep 11, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover i40e: Two trivial fixes for 09f79fd49d94

Two trivial fixes for recently introduced 09f79fd49d94 ("i40e: avoid NVM acquire deadlock during NVM update"): 1/2 fixes a comment about locking and 2/2 gets rid of two useless variables and one initializer in nvm functions.

Stefano Brivio (2):
i40e: Fix comment about locking for __i40e_read_nvm_word()
i40e: Avoid some useless variables and initializers in nvm functions

 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)
Signature · 1 line
2.9.4
#1 lore raw

PATCH 1/2 i40e: Fix comment about locking for __i40e_read_nvm_word()

Caller needs to acquire the lock. Called functions will not.

Fixes 09f79fd49d94 ("i40e: avoid NVM acquire deadlock during NVM update")
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +1 -1
index 26d7e9fe6220..200779d5c124 100644
@@ -281,7 +281,7 @@ static i40e_status i40e_read_nvm_word_aq(struct i40e_hw *hw, u16 offset,
 }
 
 /**
- * __i40e_read_nvm_word - Reads nvm word, assumes called does the locking
+ * __i40e_read_nvm_word - Reads nvm word, assumes caller does the locking
  * @hw: pointer to the HW structure
  * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
  * @data: word read from the Shadow RAM
Signature · 1 line
2.9.4
#4 lore raw

PATCH 2/2 i40e: Avoid some useless variables and initializers in nvm functions

In reply to Stefano Brivio
Fixes 09f79fd49d94 ("i40e: avoid NVM acquire deadlock during NVM update")
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +7 -13
index 200779d5c124..4a8a81cd3e32 100644
@@ -294,13 +294,10 @@ static i40e_status i40e_read_nvm_word_aq(struct i40e_hw *hw, u16 offset,
 static i40e_status __i40e_read_nvm_word(struct i40e_hw *hw,
 					u16 offset, u16 *data)
 {
-	i40e_status ret_code = 0;
-
 	if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)
-		ret_code = i40e_read_nvm_word_aq(hw, offset, data);
-	else
-		ret_code = i40e_read_nvm_word_srctl(hw, offset, data);
-	return ret_code;
+		return i40e_read_nvm_word_aq(hw, offset, data);
+
+	return i40e_read_nvm_word_srctl(hw, offset, data);
 }
 
 /**
@@ -314,7 +311,7 @@ static i40e_status __i40e_read_nvm_word(struct i40e_hw *hw,
 i40e_status i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
 			       u16 *data)
 {
-	i40e_status ret_code = 0;
+	i40e_status ret_code;
 
 	ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
 	if (ret_code)
@@ -429,13 +426,10 @@ static i40e_status __i40e_read_nvm_buffer(struct i40e_hw *hw,
 					  u16 offset, u16 *words,
 					  u16 *data)
 {
-	i40e_status ret_code = 0;
-
 	if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)
-		ret_code = i40e_read_nvm_buffer_aq(hw, offset, words, data);
-	else
-		ret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data);
-	return ret_code;
+		return i40e_read_nvm_buffer_aq(hw, offset, words, data);
+
+	return i40e_read_nvm_buffer_srctl(hw, offset, words, data);
 }
 
 /**
Signature · 1 line
2.9.4
#5 lore raw

Re: [PATCH net 2/2] i40e: Avoid some useless variables and initializers in nvm functions

Quoted 6 lines · Stefano Brivio
Fixes 09f79fd49d94 ("i40e: avoid NVM acquire deadlock during NVM

update")

---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

This is NOT a fix, it is a coding style preference whether or not you
like multiple returns or a single return in functions. I do not mind
picking this up for net-next (4.15 kernel), but this does not qualify
for a fix for Dave's net tree.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20170906/b948ff49/attachment.asc>

#2 lore raw

Re: [PATCH net 1/2] i40e: Fix comment about locking for __i40e_read_nvm_word()

In reply to Stefano Brivio
Quoted 8 lines · Stefano Brivio

Caller needs to acquire the lock. Called functions will not.

Fixes 09f79fd49d94 ("i40e: avoid NVM acquire deadlock during NVM

update")

---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Yes, this fixes the function header comment, not sure if it requires
the "Fixes:" tag. If that were the case, wonder why all the other code
comment changes do not have this. :-) I do agree it reads better with
this change, so I do not have an issue queue this up for Dave's net
tree.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20170906/dcd1c398/attachment.asc>

#3 lore raw

PATCH 1/2 i40e: Fix comment about locking for __i40e_read_nvm_word()

In reply to Stefano Brivio
Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Stefano Brivio
Sent: Wednesday, September 6, 2017 1:12 AM
To: Kirsher, Jeffrey T <[email protected]>;
netdev at vger.kernel.org; intel-wired-lan at lists.osuosl.org
Cc: David S . Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH net 1/2] i40e: Fix comment about locking for __i40e_read_nvm_word()

Quoted 8 lines

Caller needs to acquire the lock. Called functions will not.

Fixes 09f79fd49d94 ("i40e: avoid NVM acquire deadlock during NVM

update")

---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#6 lore raw

PATCH 2/2 i40e: Avoid some useless variables and initializers in nvm functions

In reply to Stefano Brivio
Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Stefano Brivio
Sent: Wednesday, September 6, 2017 1:12 AM
To: Kirsher, Jeffrey T <[email protected]>;
netdev at vger.kernel.org; intel-wired-lan at lists.osuosl.org
Cc: David S . Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH net 2/2] i40e: Avoid some useless variables and initializers in nvm functions

Quoted 6 lines
Fixes 09f79fd49d94 ("i40e: avoid NVM acquire deadlock during NVM

update")

---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)