Thread (17 messages) 17 messages, 2 authors, 2012-02-13

[net-next 01/15] e1000e: cleanup: use goto for common work needed by multiple exit points

flat view
STALE5362d SUPERSEDED: 1 (0M)

From: Jeff Kirsher <hidden>
Date: 2012-02-13 21:47:55
Subsystem: intel ethernet drivers, networking drivers, the rest · Maintainers: Tony Nguyen, Przemek Kitszel, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Revision v1 of 227 in this series; 1 review trailer.

Revisions (227)
  1. v1
  2. v1
  3. v2 [diff vs current]
  4. v1
  5. v1
  6. v1
  7. v2 [diff vs current]
  8. v1
  9. v1
  10. v1
  11. v1
  12. v1
  13. v1
  14. v1
  15. v1
  16. v1
  17. v1
  18. v2 [diff vs current]
  19. v1
  20. v3 [diff vs current]
  21. v1
  22. v1
  23. v1
  24. v2 [diff vs current]
  25. v2 [diff vs current]
  26. v1
  27. v2 [diff vs current]
  28. v1
  29. v2 [diff vs current]
  30. v3 [diff vs current]
  31. v1
  32. v1
  33. v1
  34. v2 [diff vs current]
  35. v1
  36. v1
  37. v1
  38. v2 [diff vs current]
  39. v1
  40. v1
  41. v1
  42. v1
  43. v1
  44. v2 [diff vs current]
  45. v1
  46. v2 [diff vs current]
  47. v1
  48. v1 current
  49. v1
  50. v1
  51. v1
  52. v1
  53. v1
  54. v1
  55. v1
  56. v1
  57. v1
  58. v1
  59. v1
  60. v1
  61. v1
  62. v1
  63. v1
  64. v1
  65. v1
  66. v1
  67. v1
  68. v2 [diff vs current]
  69. v1
  70. v2 [diff vs current]
  71. v1
  72. v1
  73. v2 [diff vs current]
  74. v1
  75. v1
  76. v1
  77. v2 [diff vs current]
  78. v3 [diff vs current]
  79. v1
  80. v2 [diff vs current]
  81. v1
  82. v1
  83. v1
  84. v1
  85. v1
  86. v1
  87. v1
  88. v1
  89. v1
  90. v1
  91. v1
  92. v1
  93. v1
  94. v1
  95. v1
  96. v1
  97. v1
  98. v1
  99. v1
  100. v1
  101. v1
  102. v2 [diff vs current]
  103. v1
  104. v1
  105. v1
  106. v1
  107. v1
  108. v1
  109. v1
  110. v1
  111. v1
  112. v2 [diff vs current]
  113. v1
  114. v1
  115. v1
  116. v1
  117. v1
  118. v2 [diff vs current]
  119. v1
  120. v1
  121. v1
  122. v1
  123. v1
  124. v2 [diff vs current]
  125. v1
  126. v2 [diff vs current]
  127. v1
  128. v1
  129. v1
  130. v1
  131. v1
  132. v1
  133. v1
  134. v1
  135. v1
  136. v1
  137. v1
  138. v1
  139. v2 [diff vs current]
  140. v1
  141. v1
  142. v2 [diff vs current]
  143. v1
  144. v1
  145. v1
  146. v1
  147. v1
  148. v1
  149. v2 [diff vs current]
  150. v1
  151. v2 [diff vs current]
  152. v2 [diff vs current]
  153. v1
  154. v2 [diff vs current]
  155. v3 [diff vs current]
  156. v1
  157. v4 [diff vs current]
  158. v1
  159. v5 [diff vs current]
  160. v6 [diff vs current]
  161. v7 [diff vs current]
  162. v1
  163. v1
  164. v2 [diff vs current]
  165. v1
  166. v1
  167. v1
  168. v2 [diff vs current]
  169. v1
  170. v1
  171. v1
  172. v1
  173. v1
  174. v2 [diff vs current]
  175. v1
  176. v1
  177. v1
  178. v1
  179. v2 [diff vs current]
  180. v1
  181. v1
  182. v1
  183. v2 [diff vs current]
  184. v3 [diff vs current]
  185. v4 [diff vs current]
  186. v1
  187. v1
  188. v2 [diff vs current]
  189. v5 [diff vs current]
  190. v1
  191. v1
  192. v1
  193. v2 [diff vs current]
  194. v1
  195. v1
  196. v2 [diff vs current]
  197. v3 [diff vs current]
  198. v1
  199. v2 [diff vs current]
  200. v1
  201. v1
  202. v2 [diff vs current]
  203. v1
  204. v2 [diff vs current]
  205. v1
  206. v2 [diff vs current]
  207. v3 [diff vs current]
  208. v1
  209. v1
  210. v1
  211. v2 [diff vs current]
  212. v1
  213. v1
  214. v1
  215. v1
  216. v1
  217. v1
  218. v2 [diff vs current]
  219. v1
  220. v1
  221. v1
  222. v1
  223. v2 [diff vs current]
  224. v1
  225. v1
  226. v1
  227. v2 [diff vs current]
From: Bruce Allan <redacted>

There are two exit points of e1000e_write_nvm_spi() which require the
nvm->ops.release() function pointer called just before exiting.
Consolidate the two duplicate pieces of common work with a goto.  With
this change, the value ret_val will need to be returned instead of 0.

Signed-off-by: Bruce Allan <redacted>
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
 drivers/net/ethernet/intel/e1000e/nvm.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/nvm.c b/drivers/net/ethernet/intel/e1000e/nvm.c
index f6fb7a7..1b50db5 100644
--- a/drivers/net/ethernet/intel/e1000e/nvm.c
+++ b/drivers/net/ethernet/intel/e1000e/nvm.c
@@ -382,10 +382,8 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 		u8 write_opcode = NVM_WRITE_OPCODE_SPI;
 
 		ret_val = e1000_ready_nvm_eeprom(hw);
-		if (ret_val) {
-			nvm->ops.release(hw);
-			return ret_val;
-		}
+		if (ret_val)
+			goto release;
 
 		e1000_standby_nvm(hw);
 
@@ -422,8 +420,10 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 	}
 
 	usleep_range(10000, 20000);
+release:
 	nvm->ops.release(hw);
-	return 0;
+
+	return ret_val;
 }
 
 /**
-- 
1.7.7.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help