* [PATCH 00/36] treewide: remove conditional returns with no effect
@ 2026-07-23 18:45 Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 04/36] dpll: zl3073x: remove conditional return " Sang-Heon Jeon
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
To: Julia.Lawall, Alex Deucher, Alexander Shishkin, Alexandre Belloni,
Andrew Lunn, Andrew Morton, Arkadiusz Kubalewski, Borislav Petkov,
Christian König, Daniel Lezcano, David Airlie,
David S. Miller, Dmitry Torokhov, Eric Dumazet, Florian Westphal,
Greg Kroah-Hartman, Hans de Goede, Hans Verkuil, Heikki Krogerus,
Herbert Xu, Ilpo Järvinen, Jakub Kicinski,
James E.J. Bottomley, Jani Nikula, Jaroslav Kysela,
Jason Gunthorpe, Jiri Pirko, Joerg Roedel (AMD), Johan Hovold,
Jonathan Cameron, Joonas Lahtinen, Julian Anastasov,
Leon Romanovsky, Liam Girdwood, Linus Walleij, Maarten Lankhorst,
Mark Brown, Martin K. Petersen, Matthew Sakai,
Mauro Carvalho Chehab, Maxime Ripard, Michael Turquette,
Mike Rapoport, Miri Korenblit, Nicolas Palix, Pablo Neira Ayuso,
Paolo Abeni, Ping-Ke Shih, Rafael J. Wysocki, Rodrigo Vivi,
Sebastian Reichel, Shuah Khan, Simona Vetter, Simon Horman,
Stephen Boyd, Steve French, Takashi Iwai, Thomas Renninger,
Thomas Zimmermann, Tony Luck, Tvrtko Ursulin, Vadim Fedorenko,
Vinod Koul, Will Deacon, Yazen Ghannam
Cc: cocci, amd-gfx, dmaengine, dm-devel, dri-devel, intel-gfx,
intel-wired-lan, iommu, linux-cifs, linux-clk, linux-crypto,
linux-edac, linux-gpio, linux-iio, linux-input, linux-kernel,
linux-media, linux-mm, linux-pm, linux-rdma, linux-rtc,
linux-s390, linux-scsi, linux-sound, linux-usb, linux-wireless,
lvs-devel, netdev, netfilter-devel, nouveau, platform-driver-x86
Hello,
While reading mm/memblock, I found a conditional return where both
branches return the same value:
err = do_something();
if (err)
return err;
return err;
Such code is usually a leftover from removing a statement between
the two returns, and the tree has about a hundred of these.
Patch 1 adds a Coccinelle script that matches the pattern, including
negation and constant-comparison variants. Where a local variable is
assigned right before the check, the assignment and the two returns
turn into a single return of the assigned expression.
Patches 2-36 are generated by the script, with hand fixes to restore
unexpectedly removed comments and to fix the formatting checkpatch.pl
complained about.
The patches are grouped by subsystem instead of split per file. If
you would rather split, merge or drop your part, just let me know
and I will address it in the next version.
All patches are independent and can be applied separately, but for
everyone's convenience, it would be nice if they were merged through
a single tree.
The series is based on next-20260721.
Sang-Heon Jeon (36):
coccinelle: misc: add cond_return_no_effect.cocci
drm/amd: remove conditional return with no effect
drm/radeon: remove conditional return with no effect
dpll: zl3073x: remove conditional return with no effect
drm/i915: remove conditional return with no effect
drm: remove conditional return with no effect
net: ethernet: remove conditional return with no effect
net: remove conditional return with no effect
net: intel: remove conditional return with no effect
wifi: remove conditional return with no effect
ipvs: remove conditional return with no effect
media: remove conditional return with no effect
ALSA: remove conditional return with no effect
ASoC: remove conditional return with no effect
iio: remove conditional return with no effect
Input: remove conditional return with no effect
clk: remove conditional return with no effect
crypto: drivers - remove conditional return with no effect
dmaengine: qcom_hidma: remove conditional return with no effect
stm class: remove conditional return with no effect
RDMA/ocrdma: remove conditional return with no effect
iommu/s390: remove conditional return with no effect
dm vdo: remove conditional return with no effect
pinctrl: mediatek: remove conditional return with no effect
platform/x86: toshiba_haps: remove conditional return with no effect
power: supply: pm8916_lbc: remove conditional return with no effect
RAS/AMD/ATL: remove conditional return with no effect
regulator: wm831x-isink: remove conditional return with no effect
rtc: pcf2127: remove conditional return with no effect
scsi: mpt3sas: remove conditional return with no effect
thermal/drivers/k3_bandgap: remove conditional return with no effect
USB: serial: ch341: remove conditional return with no effect
usb: typec: fusb302: remove conditional return with no effect
smb: client: remove conditional return with no effect
cpupower: remove conditional return with no effect
memblock: remove conditional return with no effect
drivers/clk/clk-cs2000-cp.c | 6 +-
drivers/clk/clk-lmk04832.c | 12 +-
.../intel/qat/qat_common/adf_gen2_config.c | 8 +-
.../marvell/octeontx2/otx2_cpt_mbox_common.c | 7 +-
drivers/dma/qcom/hidma_ll.c | 6 +-
drivers/dpll/zl3073x/dpll.c | 6 +-
drivers/dpll/zl3073x/out.c | 8 +-
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 6 +-
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 6 +-
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 6 +-
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 6 +-
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 6 +-
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 6 +-
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 6 +-
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 6 +-
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 6 +-
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 +-
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 6 +-
drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 32 ++---
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 6 +-
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 +-
.../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 6 +-
.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 6 +-
.../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 19 +--
.../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 7 +-
.../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 7 +-
.../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 6 +-
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 19 +--
.../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 6 +-
.../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 10 +-
.../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 6 +-
.../gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 19 +--
.../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 6 +-
.../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c | 9 +-
.../drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c | 16 +--
drivers/gpu/drm/i915/display/intel_hdmi.c | 7 +-
drivers/gpu/drm/i915/gvt/gtt.c | 8 +-
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 6 +-
drivers/gpu/drm/nouveau/dispnv50/disp.c | 14 +-
.../drm/panel/panel-osd-osd101t2587-53ts.c | 7 +-
drivers/gpu/drm/radeon/ci_dpm.c | 6 +-
drivers/gpu/drm/radeon/kv_dpm.c | 30 ++---
drivers/gpu/drm/radeon/si_dpm.c | 14 +-
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 +-
drivers/hwtracing/stm/core.c | 8 +-
drivers/iio/light/isl29028.c | 6 +-
drivers/iio/light/tsl2583.c | 14 +-
drivers/iio/magnetometer/ak8974.c | 6 +-
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 7 +-
drivers/input/keyboard/pmic8xxx-keypad.c | 8 +-
drivers/input/mouse/synaptics_i2c.c | 6 +-
drivers/input/rmi4/rmi_smbus.c | 7 +-
drivers/iommu/s390-iommu.c | 8 +-
drivers/md/dm-vdo/encodings.c | 8 +-
drivers/media/i2c/mt9p031.c | 6 +-
.../microchip/microchip-sama7g5-isc.c | 7 +-
.../media/platform/qcom/iris/iris_resources.c | 6 +-
.../media/platform/qcom/venus/pm_helpers.c | 7 +-
drivers/media/platform/renesas/rcar-csi2.c | 6 +-
.../platform/samsung/s3c-camif/camif-core.c | 7 +-
drivers/media/usb/dvb-usb-v2/mxl111sf.c | 12 +-
drivers/media/usb/gspca/jl2005bcd.c | 7 +-
drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +-
.../ethernet/aquantia/atlantic/aq_macsec.c | 6 +-
.../ethernet/freescale/dpaa2/dpaa2-switch.c | 6 +-
drivers/net/ethernet/freescale/gianfar.c | 6 +-
drivers/net/ethernet/intel/i40e/i40e_main.c | 8 +-
drivers/net/ethernet/intel/igb/e1000_i210.c | 6 +-
drivers/net/ethernet/intel/igc/igc_phy.c | 6 +-
.../ethernet/qlogic/netxen/netxen_nic_hw.c | 7 +-
.../ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 6 +-
drivers/net/ethernet/renesas/rtsn.c | 7 +-
drivers/net/phy/microchip_t1.c | 6 +-
drivers/net/pse-pd/tps23881.c | 6 +-
drivers/net/wireless/ath/ath6kl/init.c | 6 +-
drivers/net/wireless/intel/iwlwifi/mvm/link.c | 6 +-
.../wireless/realtek/rtlwifi/rtl8821ae/hw.c | 7 +-
drivers/net/wireless/realtek/rtw89/mac.c | 6 +-
drivers/net/wireless/realtek/rtw89/mac_be.c | 6 +-
.../pinctrl/mediatek/pinctrl-mtk-common-v2.c | 6 +-
drivers/platform/x86/toshiba_haps.c | 6 +-
drivers/power/supply/pm8916_lbc.c | 8 +-
drivers/ras/amd/atl/map.c | 6 +-
drivers/regulator/wm831x-isink.c | 6 +-
drivers/rtc/rtc-pcf2127.c | 7 +-
drivers/scsi/mpt3sas/mpt3sas_base.c | 6 +-
drivers/thermal/k3_bandgap.c | 7 +-
drivers/usb/serial/ch341.c | 8 +-
drivers/usb/typec/tcpm/fusb302.c | 14 +-
fs/smb/client/smb1maperror.c | 6 +-
mm/memblock.c | 7 +-
net/netfilter/ipvs/ip_vs_sync.c | 7 +-
.../misc/cond_return_no_effect.cocci | 121 ++++++++++++++++++
sound/pci/echoaudio/echoaudio_dsp.c | 6 +-
sound/pci/echoaudio/layla24_dsp.c | 6 +-
sound/pci/riptide/riptide.c | 5 +-
sound/soc/amd/acp/acp-mach-common.c | 11 +-
sound/soc/intel/atom/sst-mfld-platform-pcm.c | 7 +-
sound/soc/samsung/smdk_spdif.c | 8 +-
sound/soc/sof/intel/hda-dsp.c | 6 +-
sound/usb/mixer_scarlett.c | 26 ++--
tools/power/cpupower/utils/powercap-info.c | 2 -
102 files changed, 295 insertions(+), 643 deletions(-)
create mode 100644 scripts/coccinelle/misc/cond_return_no_effect.cocci
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 04/36] dpll: zl3073x: remove conditional return with no effect
2026-07-23 18:45 [PATCH 00/36] treewide: remove conditional returns with no effect Sang-Heon Jeon
@ 2026-07-23 18:45 ` Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 07/36] net: ethernet: " Sang-Heon Jeon
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
To: Julia.Lawall, Ivan Vecera, Prathosh Satish, Vadim Fedorenko,
Arkadiusz Kubalewski, Jiri Pirko
Cc: cocci, linux-kernel, netdev
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/dpll/zl3073x/dpll.c | 6 +-----
drivers/dpll/zl3073x/out.c | 8 ++------
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/dpll/zl3073x/dpll.c b/drivers/dpll/zl3073x/dpll.c
index a2a641b8358f..0488ae6ac486 100644
--- a/drivers/dpll/zl3073x/dpll.c
+++ b/drivers/dpll/zl3073x/dpll.c
@@ -2272,11 +2272,7 @@ zl3073x_dpll_init_fine_phase_adjust(struct zl3073x_dev *zldev)
if (rc)
return rc;
- rc = zl3073x_write_u8(zldev, ZL_REG_SYNTH_PHASE_SHIFT_CTRL, 0x01);
- if (rc)
- return rc;
-
- return rc;
+ return zl3073x_write_u8(zldev, ZL_REG_SYNTH_PHASE_SHIFT_CTRL, 0x01);
}
/**
diff --git a/drivers/dpll/zl3073x/out.c b/drivers/dpll/zl3073x/out.c
index eb5628aebcee..410d15b96d0b 100644
--- a/drivers/dpll/zl3073x/out.c
+++ b/drivers/dpll/zl3073x/out.c
@@ -85,12 +85,8 @@ int zl3073x_out_state_fetch(struct zl3073x_dev *zldev, u8 index)
if (rc)
return rc;
- rc = zl3073x_read_u32(zldev, ZL_REG_OUTPUT_PHASE_COMP,
- &out->phase_comp);
- if (rc)
- return rc;
-
- return rc;
+ return zl3073x_read_u32(zldev, ZL_REG_OUTPUT_PHASE_COMP,
+ &out->phase_comp);
}
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 07/36] net: ethernet: remove conditional return with no effect
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
2026-07-23 20:24 ` Niklas Söderlund
2026-07-23 20:35 ` Kiyanovski, Arthur
2026-07-23 18:45 ` [PATCH 08/36] net: " Sang-Heon Jeon
` (2 subsequent siblings)
4 siblings, 2 replies; 9+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
To: Julia.Lawall, Arthur Kiyanovski, David Arinzon, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Sukhdeep Singh, Ioana Ciornei, Claudiu Manoil, Manish Chopra,
Rahul Verma, Shahed Shaikh, Niklas Söderlund,
Sabrina Dubroca
Cc: cocci, GR-Linux-NIC-Dev, linux-kernel, linux-renesas-soc, netdev
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 08/36] net: remove conditional return with no effect
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 ` [PATCH 07/36] net: ethernet: " Sang-Heon Jeon
@ 2026-07-23 18:45 ` 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
4 siblings, 1 reply; 9+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
To: Julia.Lawall, Arun Ramadoss, Andrew Lunn, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Oleksij Rempel, Kory Maincent
Cc: cocci, linux-kernel, netdev, Russell King, UNGLinuxDriver
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/phy/microchip_t1.c | 6 +-----
drivers/net/pse-pd/tps23881.c | 6 +-----
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 62b36a318100..3292b2235c8f 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -1028,11 +1028,7 @@ static int lan87xx_read_status(struct phy_device *phydev)
if (rc < 0)
return rc;
- rc = genphy_read_status_fixed(phydev);
- if (rc < 0)
- return rc;
-
- return rc;
+ return genphy_read_status_fixed(phydev);
}
static int lan87xx_config_aneg(struct phy_device *phydev)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index 49d6389da067..8a3bbd623412 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -1520,11 +1520,7 @@ static int tps23881_i2c_probe(struct i2c_client *client)
"failed to register PSE controller\n");
}
- ret = tps23881_setup_irq(priv, client->irq);
- if (ret)
- return ret;
-
- return ret;
+ return tps23881_setup_irq(priv, client->irq);
}
static const struct i2c_device_id tps23881_id[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 09/36] net: intel: remove conditional return with no effect
2026-07-23 18:45 [PATCH 00/36] treewide: remove conditional returns with no effect Sang-Heon Jeon
` (2 preceding siblings ...)
2026-07-23 18:45 ` [PATCH 08/36] net: " Sang-Heon Jeon
@ 2026-07-23 18:45 ` Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 11/36] ipvs: " Sang-Heon Jeon
4 siblings, 0 replies; 9+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
To: Julia.Lawall, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: cocci, intel-wired-lan, linux-kernel, netdev
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/intel/i40e/i40e_main.c | 8 +-------
drivers/net/ethernet/intel/igb/e1000_i210.c | 6 +-----
drivers/net/ethernet/intel/igc/igc_phy.c | 6 +-----
3 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a04683004a56..0cd0e5597c90 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4864,16 +4864,10 @@ static void i40e_control_rx_q(struct i40e_pf *pf, int pf_q, bool enable)
**/
int i40e_control_wait_rx_q(struct i40e_pf *pf, int pf_q, bool enable)
{
- int ret = 0;
-
i40e_control_rx_q(pf, pf_q, enable);
/* wait for the change to finish */
- ret = i40e_pf_rxq_wait(pf, pf_q, enable);
- if (ret)
- return ret;
-
- return ret;
+ return i40e_pf_rxq_wait(pf, pf_q, enable);
}
/**
diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c
index 9db29b231d6a..784f9a7bcbed 100644
--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
+++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
@@ -756,11 +756,7 @@ static s32 __igb_access_xmdio_reg(struct e1000_hw *hw, u16 address,
return ret_val;
/* Recalibrate the device back to 0 */
- ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0);
- if (ret_val)
- return ret_val;
-
- return ret_val;
+ return hw->phy.ops.write_reg(hw, E1000_MMDAC, 0);
}
/**
diff --git a/drivers/net/ethernet/intel/igc/igc_phy.c b/drivers/net/ethernet/intel/igc/igc_phy.c
index 4cf737fb3b21..b758a7e0f013 100644
--- a/drivers/net/ethernet/intel/igc/igc_phy.c
+++ b/drivers/net/ethernet/intel/igc/igc_phy.c
@@ -675,11 +675,7 @@ static s32 __igc_access_xmdio_reg(struct igc_hw *hw, u16 address,
return ret_val;
/* Recalibrate the device back to 0 */
- ret_val = hw->phy.ops.write_reg(hw, IGC_MMDAC, 0);
- if (ret_val)
- return ret_val;
-
- return ret_val;
+ return hw->phy.ops.write_reg(hw, IGC_MMDAC, 0);
}
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 11/36] ipvs: remove conditional return with no effect
2026-07-23 18:45 [PATCH 00/36] treewide: remove conditional returns with no effect Sang-Heon Jeon
` (3 preceding siblings ...)
2026-07-23 18:45 ` [PATCH 09/36] net: intel: " Sang-Heon Jeon
@ 2026-07-23 18:45 ` Sang-Heon Jeon
4 siblings, 0 replies; 9+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
To: Julia.Lawall, Simon Horman, Julian Anastasov, Pablo Neira Ayuso,
Florian Westphal, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: cocci, coreteam, linux-kernel, lvs-devel, netdev, netfilter-devel,
Phil Sutter, Simon Horman
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>
---
net/netfilter/ipvs/ip_vs_sync.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 93038abbf5e0..bd4f7e906cf7 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1603,15 +1603,10 @@ ip_vs_receive(struct socket *sock, char *buffer, const size_t buflen)
{
struct msghdr msg = {NULL,};
struct kvec iov = {buffer, buflen};
- int len;
/* Receive a packet */
iov_iter_kvec(&msg.msg_iter, ITER_DEST, &iov, 1, buflen);
- len = sock_recvmsg(sock, &msg, MSG_DONTWAIT);
- if (len < 0)
- return len;
-
- return len;
+ return sock_recvmsg(sock, &msg, MSG_DONTWAIT);
}
/* Wakeup the master thread for sending */
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 08/36] net: remove conditional return with no effect
2026-07-23 18:45 ` [PATCH 08/36] net: " Sang-Heon Jeon
@ 2026-07-23 19:04 ` Andrew Lunn
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2026-07-23 19:04 UTC (permalink / raw)
To: Sang-Heon Jeon
Cc: Julia.Lawall, Arun Ramadoss, Heiner Kallweit, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Oleksij Rempel,
Kory Maincent, cocci, linux-kernel, netdev, Russell King,
UNGLinuxDriver
On Fri, Jul 24, 2026 at 03:45:10AM +0900, Sang-Heon Jeon wrote:
> 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>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 07/36] net: ethernet: remove conditional return with no effect
2026-07-23 18:45 ` [PATCH 07/36] net: ethernet: " Sang-Heon Jeon
@ 2026-07-23 20:24 ` Niklas Söderlund
2026-07-23 20:35 ` Kiyanovski, Arthur
1 sibling, 0 replies; 9+ messages in thread
From: Niklas Söderlund @ 2026-07-23 20:24 UTC (permalink / raw)
To: Sang-Heon Jeon
Cc: Julia.Lawall, Arthur Kiyanovski, David Arinzon, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Sukhdeep Singh, Ioana Ciornei, Claudiu Manoil, Manish Chopra,
Rahul Verma, Shahed Shaikh, Sabrina Dubroca, cocci,
GR-Linux-NIC-Dev, linux-kernel, linux-renesas-soc, netdev
Hello Sang-Heon,
Thanks for your work.
On 2026-07-24 03:45:09 +0900, Sang-Heon Jeon wrote:
> 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 +------
For rtsn.c,
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 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
>
--
Kind Regards,
Niklas Söderlund
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 07/36] net: ethernet: remove conditional return with no effect
2026-07-23 18:45 ` [PATCH 07/36] net: ethernet: " Sang-Heon Jeon
2026-07-23 20:24 ` Niklas Söderlund
@ 2026-07-23 20:35 ` Kiyanovski, Arthur
1 sibling, 0 replies; 9+ messages in thread
From: Kiyanovski, Arthur @ 2026-07-23 20:35 UTC (permalink / raw)
To: Sang-Heon Jeon, Julia.Lawall@inria.fr, Arinzon, David,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Sukhdeep Singh, Ioana Ciornei, Claudiu Manoil,
Manish Chopra, Rahul Verma, Shahed Shaikh, Niklas Söderlund,
Sabrina Dubroca
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
> -----Original Message-----
> Subject: [EXTERNAL] [PATCH 07/36] net: ethernet: remove conditional return
> with no effect
>
> 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
Thank you for this patch.
For ena_netdev.c:
Reviewed-by: Arthur Kiyanovski <akiyano@amazon.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-07-23 20:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 07/36] net: ethernet: " Sang-Heon Jeon
2026-07-23 20:24 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox