netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e1000e: Remove not useful `else' after a break or return
@ 2023-06-09  2:54 Baozhu Ni
  2023-06-13 16:55 ` Tony Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: Baozhu Ni @ 2023-06-09  2:54 UTC (permalink / raw)
  To: Jesse Brandeburg, Tony Nguyen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni,
	moderated list:INTEL ETHERNET DRIVERS,
	open list:NETWORKING DRIVERS, open list, Outreachy

`else' is not generally useful after a break or return

Signed-off-by: Baozhu Ni <nibaozhu@yeah.net>
---
 .../net/ethernet/intel/e1000e/80003es2lan.c   |  5 +-
 drivers/net/ethernet/intel/e1000e/ich8lan.c   | 59 +++++++++----------
 2 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
index be9c695dde12..f063e2bd48fa 100644
--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
@@ -43,11 +43,10 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
 	if (hw->phy.media_type != e1000_media_type_copper) {
 		phy->type = e1000_phy_none;
 		return 0;
-	} else {
-		phy->ops.power_up = e1000_power_up_phy_copper;
-		phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan;
 	}
 
+	phy->ops.power_up = e1000_power_up_phy_copper;
+	phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan;
 	phy->addr = 1;
 	phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
 	phy->reset_delay_us = 100;
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 0c7fd10312c8..8ab4e45de5f2 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -3592,9 +3592,8 @@ static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
 	 */
 	if (hw->mac.type >= e1000_pch_spt)
 		return -E1000_ERR_NVM;
-	else
-		ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word);
 
+	ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word);
 	if (ret_val)
 		return ret_val;
 
@@ -3659,20 +3658,20 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
 			else if (size == 2)
 				*data = (u16)(flash_data & 0x0000FFFF);
 			break;
-		} else {
-			/* If we've gotten here, then things are probably
-			 * completely hosed, but if the error condition is
-			 * detected, it won't hurt to give it another try...
-			 * ICH_FLASH_CYCLE_REPEAT_COUNT times.
-			 */
-			hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
-			if (hsfsts.hsf_status.flcerr) {
-				/* Repeat for some time before giving up. */
-				continue;
-			} else if (!hsfsts.hsf_status.flcdone) {
-				e_dbg("Timeout error - flash cycle did not complete.\n");
-				break;
-			}
+		}
+
+		/* If we've gotten here, then things are probably
+		 * completely hosed, but if the error condition is
+		 * detected, it won't hurt to give it another try...
+		 * ICH_FLASH_CYCLE_REPEAT_COUNT times.
+		 */
+		hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
+		if (hsfsts.hsf_status.flcerr) {
+			/* Repeat for some time before giving up. */
+			continue;
+		} else if (!hsfsts.hsf_status.flcdone) {
+			e_dbg("Timeout error - flash cycle did not complete.\n");
+			break;
 		}
 	} while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
 
@@ -3734,20 +3733,20 @@ static s32 e1000_read_flash_data32_ich8lan(struct e1000_hw *hw, u32 offset,
 		if (!ret_val) {
 			*data = er32flash(ICH_FLASH_FDATA0);
 			break;
-		} else {
-			/* If we've gotten here, then things are probably
-			 * completely hosed, but if the error condition is
-			 * detected, it won't hurt to give it another try...
-			 * ICH_FLASH_CYCLE_REPEAT_COUNT times.
-			 */
-			hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
-			if (hsfsts.hsf_status.flcerr) {
-				/* Repeat for some time before giving up. */
-				continue;
-			} else if (!hsfsts.hsf_status.flcdone) {
-				e_dbg("Timeout error - flash cycle did not complete.\n");
-				break;
-			}
+		}
+
+		/* If we've gotten here, then things are probably
+		 * completely hosed, but if the error condition is
+		 * detected, it won't hurt to give it another try...
+		 * ICH_FLASH_CYCLE_REPEAT_COUNT times.
+		 */
+		hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
+		if (hsfsts.hsf_status.flcerr) {
+			/* Repeat for some time before giving up. */
+			continue;
+		} else if (!hsfsts.hsf_status.flcdone) {
+			e_dbg("Timeout error - flash cycle did not complete.\n");
+			break;
 		}
 	} while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] e1000e: Remove not useful `else' after a break or return
  2023-06-09  2:54 [PATCH] e1000e: Remove not useful `else' after a break or return Baozhu Ni
@ 2023-06-13 16:55 ` Tony Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Nguyen @ 2023-06-13 16:55 UTC (permalink / raw)
  To: Baozhu Ni, Jesse Brandeburg, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni,
	moderated list:INTEL ETHERNET DRIVERS,
	open list:NETWORKING DRIVERS, open list, Outreachy

On 6/8/2023 7:54 PM, Baozhu Ni wrote:
> `else' is not generally useful after a break or return

networking doesn't take checkpatch only fixes. While this doesn't 
explicitly reference checkpatch, the message and changes address solely 
checkpatch issues. Sorry.

> Signed-off-by: Baozhu Ni <nibaozhu@yeah.net>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-13 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09  2:54 [PATCH] e1000e: Remove not useful `else' after a break or return Baozhu Ni
2023-06-13 16:55 ` Tony Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).