e1000/base: check more errors for ESB2 init and reset
authorWenzhuo Lu <wenzhuo.lu@intel.com>
Fri, 16 Oct 2015 02:50:58 +0000 (10:50 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 27 Oct 2015 13:20:24 +0000 (14:20 +0100)
Adding code where missing to handle case where calls to
e1000_read_kmrn_reg_80003es2lan and e1000_write_kmrn_reg_80003es2lan return
an error value.
Also, when accessing the E1000_KMRNCTRLSTA_INBAND_PARAM offset to disable
far-end loopback on 80003es2lan devices, make the handling of a read or
write failure consistent between hw_init and hw_reset.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
drivers/net/e1000/base/e1000_80003es2lan.c

index b79496b..5ac925e 100644 (file)
@@ -852,11 +852,15 @@ STATIC s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
        /* Disable IBIST slave mode (far-end loopback) */
        ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
                                E1000_KMRNCTRLSTA_INBAND_PARAM, &kum_reg_data);
-       if (ret_val)
-               return ret_val;
-       kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
-       e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
-                                       kum_reg_data);
+       if (!ret_val) {
+               kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
+               ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
+                                                E1000_KMRNCTRLSTA_INBAND_PARAM,
+                                                kum_reg_data);
+               if (ret_val)
+                       DEBUGOUT("Error disabling far-end loopback\n");
+       } else
+               DEBUGOUT("Error disabling far-end loopback\n");
 
        ret_val = e1000_get_auto_rd_done_generic(hw);
        if (ret_val)
@@ -912,11 +916,18 @@ STATIC s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
                return ret_val;
 
        /* Disable IBIST slave mode (far-end loopback) */
-       e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
-                                       &kum_reg_data);
-       kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
-       e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
-                                        kum_reg_data);
+       ret_val =
+           e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
+                                           &kum_reg_data);
+       if (!ret_val) {
+               kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
+               ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
+                                                E1000_KMRNCTRLSTA_INBAND_PARAM,
+                                                kum_reg_data);
+               if (ret_val)
+                       DEBUGOUT("Error disabling far-end loopback\n");
+       } else
+               DEBUGOUT("Error disabling far-end loopback\n");
 
        /* Set the transmit descriptor write-back policy */
        reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0));