From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: Julia.Lawall@inria.fr, "Arthur Kiyanovski" <akiyano@amazon.com>,
"David Arinzon" <darinzon@amazon.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Sukhdeep Singh" <sukhdeeps@marvell.com>,
"Ioana Ciornei" <ioana.ciornei@nxp.com>,
"Claudiu Manoil" <claudiu.manoil@nxp.com>,
"Manish Chopra" <manishc@marvell.com>,
"Rahul Verma" <rahulv@marvell.com>,
"Shahed Shaikh" <shshaikh@marvell.com>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Sabrina Dubroca" <sd@queasysnail.net>
Cc: cocci@inria.fr, GR-Linux-NIC-Dev@marvell.com,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
netdev@vger.kernel.org
Subject: [PATCH 07/36] net: ethernet: remove conditional return with no effect
Date: Fri, 24 Jul 2026 03:45:09 +0900 [thread overview]
Message-ID: <20260723184538.3888637-8-ekffu200098@gmail.com> (raw)
In-Reply-To: <20260723184538.3888637-1-ekffu200098@gmail.com>
Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.
This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +-----
drivers/net/ethernet/aquantia/atlantic/aq_macsec.c | 6 +-----
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 6 +-----
drivers/net/ethernet/freescale/gianfar.c | 6 +-----
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c | 7 +------
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 6 +-----
drivers/net/ethernet/renesas/rtsn.c | 7 +------
7 files changed, 7 insertions(+), 37 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 5d05020a6d05..ea89619039d8 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -2303,11 +2303,7 @@ static int ena_open(struct net_device *netdev)
return rc;
}
- rc = ena_up(adapter);
- if (rc)
- return rc;
-
- return rc;
+ return ena_up(adapter);
}
/* ena_close - Disables a network interface
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
index 3ca072360ec7..fd4ee6212234 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
@@ -735,11 +735,7 @@ static int aq_set_rxsc(struct aq_nic_s *nic, const u32 rxsc_idx)
sc_record.valid = 1;
sc_record.fresh = 1;
- ret = aq_mss_set_ingress_sc_record(hw, &sc_record, hw_sc_idx);
- if (ret)
- return ret;
-
- return ret;
+ return aq_mss_set_ingress_sc_record(hw, &sc_record, hw_sc_idx);
}
static int aq_mdo_add_rxsc(struct macsec_context *ctx)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index 33e7a99d3e49..79d4a77f72bd 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -3935,11 +3935,7 @@ static int dpaa2_switch_port_init(struct ethsw_port_priv *port_priv, u16 port)
if (err)
return err;
- err = dpaa2_switch_port_trap_mac_addr(port_priv, ll_mac, ll_mask);
- if (err)
- return err;
-
- return err;
+ return dpaa2_switch_port_trap_mac_addr(port_priv, ll_mac, ll_mask);
}
static void dpaa2_switch_ctrl_if_teardown(struct ethsw_core *ethsw)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 89215e1ddc2d..cf636fc5aafa 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2877,11 +2877,7 @@ static int gfar_enet_open(struct net_device *dev)
if (err)
return err;
- err = startup_gfar(dev);
- if (err)
- return err;
-
- return err;
+ return startup_gfar(dev);
}
/* Stops the kernel queue, and halts the controller */
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
index fff8dc84212d..e96a268067f2 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
@@ -2478,7 +2478,6 @@ static int netxen_parse_md_template(struct netxen_adapter *adapter)
static int
netxen_collect_minidump(struct netxen_adapter *adapter)
{
- int ret = 0;
struct netxen_minidump_template_hdr *hdr;
hdr = (struct netxen_minidump_template_hdr *)
adapter->mdump.md_template;
@@ -2486,11 +2485,7 @@ netxen_collect_minidump(struct netxen_adapter *adapter)
hdr->driver_timestamp = ktime_get_seconds();
hdr->driver_info_word2 = adapter->fw_version;
hdr->driver_info_word3 = NXRD32(adapter, CRB_DRIVER_VERSION);
- ret = netxen_parse_md_template(adapter);
- if (ret)
- return ret;
-
- return ret;
+ return netxen_parse_md_template(adapter);
}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index 45ed8705c7ca..47cd9ec665ee 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -1618,11 +1618,7 @@ static int qlcnic_83xx_check_hw_status(struct qlcnic_adapter *p_dev)
if (err)
return err;
- err = qlcnic_83xx_check_heartbeat(p_dev);
- if (err)
- return err;
-
- return err;
+ return qlcnic_83xx_check_heartbeat(p_dev);
}
static int qlcnic_83xx_poll_reg(struct qlcnic_adapter *p_dev, u32 addr,
diff --git a/drivers/net/ethernet/renesas/rtsn.c b/drivers/net/ethernet/renesas/rtsn.c
index ee8381b60b8d..f7beeb73eb16 100644
--- a/drivers/net/ethernet/renesas/rtsn.c
+++ b/drivers/net/ethernet/renesas/rtsn.c
@@ -685,7 +685,6 @@ static void rtsn_set_rate(struct rtsn_private *priv)
static int rtsn_rmac_init(struct rtsn_private *priv)
{
const u8 *mac_addr = priv->ndev->dev_addr;
- int ret;
/* Set MAC address */
rtsn_write(priv, MRMAC0, (mac_addr[0] << 8) | mac_addr[1]);
@@ -702,11 +701,7 @@ static int rtsn_rmac_init(struct rtsn_private *priv)
/* Link verification */
rtsn_modify(priv, MLVC, MLVC_PLV, MLVC_PLV);
- ret = rtsn_reg_wait(priv, MLVC, MLVC_PLV, 0);
- if (ret)
- return ret;
-
- return ret;
+ return rtsn_reg_wait(priv, MLVC, MLVC_PLV, 0);
}
static int rtsn_hw_init(struct rtsn_private *priv)
--
2.43.0
next prev parent reply other threads:[~2026-07-23 18:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 18:45 [PATCH 00/36] treewide: remove conditional returns with no effect Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 04/36] dpll: zl3073x: remove conditional return " Sang-Heon Jeon
2026-07-23 18:45 ` Sang-Heon Jeon [this message]
2026-07-23 20:24 ` [PATCH 07/36] net: ethernet: " Niklas Söderlund
2026-07-23 20:35 ` Kiyanovski, Arthur
2026-07-23 18:45 ` [PATCH 08/36] net: " Sang-Heon Jeon
2026-07-23 19:04 ` Andrew Lunn
2026-07-23 18:45 ` [PATCH 09/36] net: intel: " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 11/36] ipvs: " Sang-Heon Jeon
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=20260723184538.3888637-8-ekffu200098@gmail.com \
--to=ekffu200098@gmail.com \
--cc=GR-Linux-NIC-Dev@marvell.com \
--cc=Julia.Lawall@inria.fr \
--cc=akiyano@amazon.com \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=cocci@inria.fr \
--cc=darinzon@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=pabeni@redhat.com \
--cc=rahulv@marvell.com \
--cc=sd@queasysnail.net \
--cc=shshaikh@marvell.com \
--cc=sukhdeeps@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox