All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Bruce Allan <bruce.w.allan@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 01/15] e1000e: cleanup: use goto for common work needed by multiple exit points
Date: Mon, 13 Feb 2012 13:47:36 -0800	[thread overview]
Message-ID: <1329169670-5403-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1329169670-5403-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

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 <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 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

  reply	other threads:[~2012-02-13 21:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-13 21:47 [net-next 00/15][pull request] Intel Wired LAN Driver updates Jeff Kirsher
2012-02-13 21:47 ` Jeff Kirsher [this message]
2012-02-13 21:47 ` [net-next 02/15] e1000e: cleanup: rename goto labels to be more meaningful Jeff Kirsher
2012-02-13 21:47 ` [net-next 03/15] e1000e: potentially incorrect return for e1000_cfg_kmrn_10_100_80003es2lan Jeff Kirsher
2012-02-13 21:47 ` [net-next 04/15] e1000e: potential incorrect return for e1000_setup_copper_link_80003es2lan Jeff Kirsher
2012-02-13 21:47 ` [net-next 05/15] e1000e: cleanup: remove unnecessary assignments just before returning Jeff Kirsher
2012-02-13 21:47 ` [net-next 06/15] e1000e: cleanup: always return 0 Jeff Kirsher
2012-02-13 21:47 ` [net-next 07/15] e1000e: potentially incorrect return for e1000_set_d3_lplu_state_ich8lan Jeff Kirsher
2012-02-13 21:47 ` [net-next 08/15] e1000e: cleanup: remove unreachable statement Jeff Kirsher
2012-02-13 21:47 ` [net-next 09/15] e1000e: cleanup: remove unnecessary variable ret_val Jeff Kirsher
2012-02-13 21:47 ` [net-next 10/15] e1000e: cleanup: remove unnecessary test and return Jeff Kirsher
2012-02-13 21:47 ` [net-next 11/15] e1000e: cleanup: remove unnecessary variable initializations Jeff Kirsher
2012-02-13 21:47 ` [net-next 12/15] e1000e: cleanup: minor whitespace addition (insert blank line separator) Jeff Kirsher
2012-02-13 21:47 ` [net-next 13/15] e1000e: potentially incorrect return for e1000_init_hw_ich8lan Jeff Kirsher
2012-02-13 21:47 ` [net-next 14/15] e1000e: potentially incorrect return for e1000e_setup_fiber_serdes_link Jeff Kirsher
2012-02-13 21:47 ` [net-next 15/15] e1000e: cleanup goto statements to exit points without common work Jeff Kirsher
2012-02-13 23:48 ` [net-next 00/15][pull request] Intel Wired LAN Driver updates David Miller

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=1329169670-5403-2-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=bruce.w.allan@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    /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.