Patchwork [net-next,11/15] ixgbe: fix possible data corruption in read_i2c_byte

login
register
mail settings
Submitter Jeff Kirsher
Date Feb. 16, 2013, 8:33 a.m.
Message ID <1361003616-3422-12-git-send-email-jeffrey.t.kirsher@intel.com>
Download mbox | patch
Permalink /patch/220948/
State Accepted
Delegated to: David Miller
Headers show

Comments

Jeff Kirsher - Feb. 16, 2013, 8:33 a.m.
From: Emil Tantilov <emil.s.tantilov@intel.com>

This patch makes sure that the SW lock is released after all i2c
operations complete in the retry code path.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index eb534a0..d7b5bd0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -1307,9 +1307,9 @@  s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
 		break;
 
 fail:
+		ixgbe_i2c_bus_clear(hw);
 		hw->mac.ops.release_swfw_sync(hw, swfw_mask);
 		msleep(100);
-		ixgbe_i2c_bus_clear(hw);
 		retry++;
 		if (retry < max_retry)
 			hw_dbg(hw, "I2C byte read error - Retrying.\n");