Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH 00/36] treewide: remove conditional returns with no effect
@ 2026-07-23 18:45 Sang-Heon Jeon
  2026-07-23 18:45 ` [PATCH 12/36] media: remove conditional return " Sang-Heon Jeon
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ 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] 10+ messages in thread

* [PATCH 12/36] media: 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 20:26   ` Niklas Söderlund
  2026-07-24 21:48 ` [PATCH 00/36] treewide: remove conditional returns " Jakub Kicinski
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Eugen Hristev, Vikash Garodia,
	Dikshita Agarwal, Bryan O'Donoghue, Niklas Söderlund,
	Geert Uytterhoeven, Magnus Damm, Sylwester Nawrocki,
	Michael Krufky, Hans Verkuil
  Cc: cocci, Abhinav Kumar, linux-arm-msm, linux-kernel, linux-media,
	linux-renesas-soc, linux-samsung-soc

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/media/i2c/mt9p031.c                          |  6 +-----
 .../media/platform/microchip/microchip-sama7g5-isc.c |  7 +------
 drivers/media/platform/qcom/iris/iris_resources.c    |  6 +-----
 drivers/media/platform/qcom/venus/pm_helpers.c       |  7 +------
 drivers/media/platform/renesas/rcar-csi2.c           |  6 +-----
 .../media/platform/samsung/s3c-camif/camif-core.c    |  7 +------
 drivers/media/usb/dvb-usb-v2/mxl111sf.c              | 12 ++----------
 drivers/media/usb/gspca/jl2005bcd.c                  |  7 +------
 8 files changed, 9 insertions(+), 49 deletions(-)

diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index d21510caf45a..2b09e8315c8e 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -452,11 +452,7 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031)
 	ret = mt9p031_write(client, MT9P031_HORIZONTAL_BLANK, hblank - 1);
 	if (ret < 0)
 		return ret;
-	ret = mt9p031_write(client, MT9P031_VERTICAL_BLANK, vblank - 1);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return mt9p031_write(client, MT9P031_VERTICAL_BLANK, vblank - 1);
 }
 
 static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index b0302dfc3278..7383341ec51d 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -598,13 +598,8 @@ static int __maybe_unused xisc_runtime_suspend(struct device *dev)
 static int __maybe_unused xisc_runtime_resume(struct device *dev)
 {
 	struct isc_device *isc = dev_get_drvdata(dev);
-	int ret;
-
-	ret = clk_prepare_enable(isc->hclock);
-	if (ret)
-		return ret;
 
-	return ret;
+	return clk_prepare_enable(isc->hclock);
 }
 
 static const struct dev_pm_ops microchip_xisc_dev_pm_ops = {
diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
index 773f6548370a..872bd09656b1 100644
--- a/drivers/media/platform/qcom/iris/iris_resources.c
+++ b/drivers/media/platform/qcom/iris/iris_resources.c
@@ -78,11 +78,7 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)
 	if (ret)
 		return ret;
 
-	ret = pm_runtime_get_sync(pd_dev);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return pm_runtime_get_sync(pd_dev);
 }
 
 int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index be1cbd5cfe84..e88e66be4f6d 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -781,7 +781,6 @@ static int decide_core(struct venus_inst *inst)
 	unsigned long max_freq = ULONG_MAX;
 	struct device *dev = core->dev;
 	struct dev_pm_opp *opp;
-	int ret = 0;
 
 	if (legacy_binding) {
 		if (inst->session_type == VIDC_SESSION_TYPE_DEC)
@@ -829,11 +828,7 @@ static int decide_core(struct venus_inst *inst)
 	}
 
 done:
-	ret = hfi_session_set_property(inst, ptype, &cu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return hfi_session_set_property(inst, ptype, &cu);
 }
 
 static int acquire_core(struct venus_inst *inst)
diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index 7305cc4a04cb..6635f5782175 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -2273,11 +2273,7 @@ static int rcsi2_init_phtw_v3u(struct rcar_csi2 *priv,
 			return ret;
 	}
 
-	ret = rcsi2_phtw_write_array(priv, step4, ARRAY_SIZE(step4));
-	if (ret)
-		return ret;
-
-	return ret;
+	return rcsi2_phtw_write_array(priv, step4, ARRAY_SIZE(step4));
 }
 
 /* -----------------------------------------------------------------------------
diff --git a/drivers/media/platform/samsung/s3c-camif/camif-core.c b/drivers/media/platform/samsung/s3c-camif/camif-core.c
index 14eedd1ceb27..bb06847f3a63 100644
--- a/drivers/media/platform/samsung/s3c-camif/camif-core.c
+++ b/drivers/media/platform/samsung/s3c-camif/camif-core.c
@@ -301,7 +301,6 @@ static int camif_media_dev_init(struct camif_dev *camif)
 	struct media_device *md = &camif->media_dev;
 	struct v4l2_device *v4l2_dev = &camif->v4l2_dev;
 	unsigned int ip_rev = camif->variant->ip_revision;
-	int ret;
 
 	memset(md, 0, sizeof(*md));
 	snprintf(md->model, sizeof(md->model), "Samsung S3C%s CAMIF",
@@ -316,11 +315,7 @@ static int camif_media_dev_init(struct camif_dev *camif)
 
 	media_device_init(md);
 
-	ret = v4l2_device_register(camif->dev, v4l2_dev);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return v4l2_device_register(camif->dev, v4l2_dev);
 }
 
 static void camif_clk_put(struct camif_dev *camif)
diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
index 870ac3c8b085..6404eb74db32 100644
--- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c
+++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
@@ -987,11 +987,7 @@ static int mxl111sf_frontend_attach_atsc_mh(struct dvb_usb_adapter *adap)
 	if (ret < 0)
 		return ret;
 
-	ret = mxl111sf_lg2160_frontend_attach(adap, 2);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return mxl111sf_lg2160_frontend_attach(adap, 2);
 }
 
 static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap)
@@ -1007,11 +1003,7 @@ static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap)
 	if (ret < 0)
 		return ret;
 
-	ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 2);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return mxl111sf_lg2161_ep6_frontend_attach(adap, 2);
 }
 
 static int mxl111sf_frontend_attach_mercury_mh(struct dvb_usb_adapter *adap)
diff --git a/drivers/media/usb/gspca/jl2005bcd.c b/drivers/media/usb/gspca/jl2005bcd.c
index a408fcc3a060..4988fbf5005e 100644
--- a/drivers/media/usb/gspca/jl2005bcd.c
+++ b/drivers/media/usb/gspca/jl2005bcd.c
@@ -148,17 +148,12 @@ static int jl2005c_start_new_frame(struct gspca_dev *gspca_dev)
 static int jl2005c_write_reg(struct gspca_dev *gspca_dev, unsigned char reg,
 						    unsigned char value)
 {
-	int retval;
 	u8 instruction[2];
 
 	instruction[0] = reg;
 	instruction[1] = value;
 
-	retval = jl2005c_write2(gspca_dev, instruction);
-	if (retval < 0)
-			return retval;
-
-	return retval;
+	return jl2005c_write2(gspca_dev, instruction);
 }
 
 static int jl2005c_get_firmware_id(struct gspca_dev *gspca_dev)
-- 
2.43.0


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

* Re: [PATCH 12/36] media: remove conditional return with no effect
  2026-07-23 18:45 ` [PATCH 12/36] media: remove conditional return " Sang-Heon Jeon
@ 2026-07-23 20:26   ` Niklas Söderlund
  0 siblings, 0 replies; 10+ messages in thread
From: Niklas Söderlund @ 2026-07-23 20:26 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Eugen Hristev, Vikash Garodia,
	Dikshita Agarwal, Bryan O'Donoghue, Geert Uytterhoeven,
	Magnus Damm, Sylwester Nawrocki, Michael Krufky, Hans Verkuil,
	cocci, Abhinav Kumar, linux-arm-msm, linux-kernel, linux-media,
	linux-renesas-soc, linux-samsung-soc

Hi Sang-Heon,

Thanks for your work.

On 2026-07-24 03:45:14 +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/media/i2c/mt9p031.c                          |  6 +-----
>  .../media/platform/microchip/microchip-sama7g5-isc.c |  7 +------
>  drivers/media/platform/qcom/iris/iris_resources.c    |  6 +-----
>  drivers/media/platform/qcom/venus/pm_helpers.c       |  7 +------
>  drivers/media/platform/renesas/rcar-csi2.c           |  6 +-----

For rcar-csi2.c,

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

>  .../media/platform/samsung/s3c-camif/camif-core.c    |  7 +------
>  drivers/media/usb/dvb-usb-v2/mxl111sf.c              | 12 ++----------
>  drivers/media/usb/gspca/jl2005bcd.c                  |  7 +------
>  8 files changed, 9 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
> index d21510caf45a..2b09e8315c8e 100644
> --- a/drivers/media/i2c/mt9p031.c
> +++ b/drivers/media/i2c/mt9p031.c
> @@ -452,11 +452,7 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031)
>  	ret = mt9p031_write(client, MT9P031_HORIZONTAL_BLANK, hblank - 1);
>  	if (ret < 0)
>  		return ret;
> -	ret = mt9p031_write(client, MT9P031_VERTICAL_BLANK, vblank - 1);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return mt9p031_write(client, MT9P031_VERTICAL_BLANK, vblank - 1);
>  }
>  
>  static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)
> diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> index b0302dfc3278..7383341ec51d 100644
> --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> @@ -598,13 +598,8 @@ static int __maybe_unused xisc_runtime_suspend(struct device *dev)
>  static int __maybe_unused xisc_runtime_resume(struct device *dev)
>  {
>  	struct isc_device *isc = dev_get_drvdata(dev);
> -	int ret;
> -
> -	ret = clk_prepare_enable(isc->hclock);
> -	if (ret)
> -		return ret;
>  
> -	return ret;
> +	return clk_prepare_enable(isc->hclock);
>  }
>  
>  static const struct dev_pm_ops microchip_xisc_dev_pm_ops = {
> diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
> index 773f6548370a..872bd09656b1 100644
> --- a/drivers/media/platform/qcom/iris/iris_resources.c
> +++ b/drivers/media/platform/qcom/iris/iris_resources.c
> @@ -78,11 +78,7 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)
>  	if (ret)
>  		return ret;
>  
> -	ret = pm_runtime_get_sync(pd_dev);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return pm_runtime_get_sync(pd_dev);
>  }
>  
>  int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index be1cbd5cfe84..e88e66be4f6d 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -781,7 +781,6 @@ static int decide_core(struct venus_inst *inst)
>  	unsigned long max_freq = ULONG_MAX;
>  	struct device *dev = core->dev;
>  	struct dev_pm_opp *opp;
> -	int ret = 0;
>  
>  	if (legacy_binding) {
>  		if (inst->session_type == VIDC_SESSION_TYPE_DEC)
> @@ -829,11 +828,7 @@ static int decide_core(struct venus_inst *inst)
>  	}
>  
>  done:
> -	ret = hfi_session_set_property(inst, ptype, &cu);
> -	if (ret)
> -		return ret;
> -
> -	return ret;
> +	return hfi_session_set_property(inst, ptype, &cu);
>  }
>  
>  static int acquire_core(struct venus_inst *inst)
> diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
> index 7305cc4a04cb..6635f5782175 100644
> --- a/drivers/media/platform/renesas/rcar-csi2.c
> +++ b/drivers/media/platform/renesas/rcar-csi2.c
> @@ -2273,11 +2273,7 @@ static int rcsi2_init_phtw_v3u(struct rcar_csi2 *priv,
>  			return ret;
>  	}
>  
> -	ret = rcsi2_phtw_write_array(priv, step4, ARRAY_SIZE(step4));
> -	if (ret)
> -		return ret;
> -
> -	return ret;
> +	return rcsi2_phtw_write_array(priv, step4, ARRAY_SIZE(step4));
>  }
>  
>  /* -----------------------------------------------------------------------------
> diff --git a/drivers/media/platform/samsung/s3c-camif/camif-core.c b/drivers/media/platform/samsung/s3c-camif/camif-core.c
> index 14eedd1ceb27..bb06847f3a63 100644
> --- a/drivers/media/platform/samsung/s3c-camif/camif-core.c
> +++ b/drivers/media/platform/samsung/s3c-camif/camif-core.c
> @@ -301,7 +301,6 @@ static int camif_media_dev_init(struct camif_dev *camif)
>  	struct media_device *md = &camif->media_dev;
>  	struct v4l2_device *v4l2_dev = &camif->v4l2_dev;
>  	unsigned int ip_rev = camif->variant->ip_revision;
> -	int ret;
>  
>  	memset(md, 0, sizeof(*md));
>  	snprintf(md->model, sizeof(md->model), "Samsung S3C%s CAMIF",
> @@ -316,11 +315,7 @@ static int camif_media_dev_init(struct camif_dev *camif)
>  
>  	media_device_init(md);
>  
> -	ret = v4l2_device_register(camif->dev, v4l2_dev);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return v4l2_device_register(camif->dev, v4l2_dev);
>  }
>  
>  static void camif_clk_put(struct camif_dev *camif)
> diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
> index 870ac3c8b085..6404eb74db32 100644
> --- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c
> +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
> @@ -987,11 +987,7 @@ static int mxl111sf_frontend_attach_atsc_mh(struct dvb_usb_adapter *adap)
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = mxl111sf_lg2160_frontend_attach(adap, 2);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return mxl111sf_lg2160_frontend_attach(adap, 2);
>  }
>  
>  static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap)
> @@ -1007,11 +1003,7 @@ static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap)
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 2);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return mxl111sf_lg2161_ep6_frontend_attach(adap, 2);
>  }
>  
>  static int mxl111sf_frontend_attach_mercury_mh(struct dvb_usb_adapter *adap)
> diff --git a/drivers/media/usb/gspca/jl2005bcd.c b/drivers/media/usb/gspca/jl2005bcd.c
> index a408fcc3a060..4988fbf5005e 100644
> --- a/drivers/media/usb/gspca/jl2005bcd.c
> +++ b/drivers/media/usb/gspca/jl2005bcd.c
> @@ -148,17 +148,12 @@ static int jl2005c_start_new_frame(struct gspca_dev *gspca_dev)
>  static int jl2005c_write_reg(struct gspca_dev *gspca_dev, unsigned char reg,
>  						    unsigned char value)
>  {
> -	int retval;
>  	u8 instruction[2];
>  
>  	instruction[0] = reg;
>  	instruction[1] = value;
>  
> -	retval = jl2005c_write2(gspca_dev, instruction);
> -	if (retval < 0)
> -			return retval;
> -
> -	return retval;
> +	return jl2005c_write2(gspca_dev, instruction);
>  }
>  
>  static int jl2005c_get_firmware_id(struct gspca_dev *gspca_dev)
> -- 
> 2.43.0
> 

-- 
Kind Regards,
Niklas Söderlund

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

* Re: [PATCH 00/36] treewide: remove conditional returns 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 12/36] media: remove conditional return " Sang-Heon Jeon
@ 2026-07-24 21:48 ` Jakub Kicinski
  2026-07-27  8:30   ` Jani Nikula
  2026-07-24 23:35 ` (subset) " Sebastian Reichel
  2026-07-27 12:12 ` Mark Brown
  3 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2026-07-24 21:48 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: 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, 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, 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

On Fri, 24 Jul 2026 03:45:02 +0900 Sang-Heon Jeon wrote:
> 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.

Huh, I thought we already had such script. Various script children have
been sending such "cleanups" in the past.

> 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.

Please post patches 4,7,8,9 as a separate series. Since you only CCed
netdev on subset of the series patchwork thinks there are patches
missing and doesn't kick off any CI.

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

* Re: (subset) [PATCH 00/36] treewide: remove conditional returns 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 12/36] media: remove conditional return " Sang-Heon Jeon
  2026-07-24 21:48 ` [PATCH 00/36] treewide: remove conditional returns " Jakub Kicinski
@ 2026-07-24 23:35 ` Sebastian Reichel
  2026-07-27 12:12 ` Mark Brown
  3 siblings, 0 replies; 10+ messages in thread
From: Sebastian Reichel @ 2026-07-24 23:35 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, Sang-Heon Jeon
  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


On Fri, 24 Jul 2026 03:45:02 +0900, Sang-Heon Jeon wrote:
> 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;
> 
> [...]

Applied, thanks!

[26/36] power: supply: pm8916_lbc: remove conditional return with no effect
        commit: b7c8d46411317f135e7791c0eddc56691de63f07

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


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

* Re: [PATCH 00/36] treewide: remove conditional returns with no effect
  2026-07-24 21:48 ` [PATCH 00/36] treewide: remove conditional returns " Jakub Kicinski
@ 2026-07-27  8:30   ` Jani Nikula
  2026-07-27 11:08     ` Sang-Heon Jeon
  0 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2026-07-27  8:30 UTC (permalink / raw)
  To: Jakub Kicinski, Sang-Heon Jeon
  Cc: 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, James E.J. Bottomley,
	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, 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

On Fri, 24 Jul 2026, Jakub Kicinski <kuba@kernel.org> wrote:
> On Fri, 24 Jul 2026 03:45:02 +0900 Sang-Heon Jeon wrote:
>> 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.
>
> Huh, I thought we already had such script. Various script children have
> been sending such "cleanups" in the past.

We did, and it was removed, I believe in 1a617a8475e8 ("coccinelle:
misc: remove "complex return code" warnings"), because people just don't
want this constant churn.

It's perfectly fine to have the error case and happy day scenario
separated.


BR,
Jani.


-- 
Jani Nikula, Intel

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

* Re: [PATCH 00/36] treewide: remove conditional returns with no effect
  2026-07-27  8:30   ` Jani Nikula
@ 2026-07-27 11:08     ` Sang-Heon Jeon
  2026-07-27 11:36       ` Jani Nikula
  0 siblings, 1 reply; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 11:08 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Jakub Kicinski, 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,
	James E.J. Bottomley, 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, 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,

On Mon, Jul 27, 2026 at 5:30 PM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Fri, 24 Jul 2026, Jakub Kicinski <kuba@kernel.org> wrote:
> > On Fri, 24 Jul 2026 03:45:02 +0900 Sang-Heon Jeon wrote:
> >> 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.
> >
> > Huh, I thought we already had such script. Various script children have
> > been sending such "cleanups" in the past.
>
> We did, and it was removed, I believe in 1a617a8475e8 ("coccinelle:
> misc: remove "complex return code" warnings"), because people just don't
> want this constant churn.
>
> It's perfectly fine to have the error case and happy day scenario
> separated.

Thanks for sharing the history.

I checked the mailing list. The removed script looks similar to the
new one, but it is different. The removed script reported a
conditional return followed by an explicit return 0, where the error
case and happy day scenario are separated as you mentioned, and Johan
also complained about this 10 years ago.

But the new script only reports when both branches return the same
variable, not the explicit 0. So, I think the new script is close to
the restricted version that Julia mentioned 10 years ago, and it
should be acceptable.

>
> BR,
> Jani.
>
>
> --
> Jani Nikula, Intel

Best Regards,
Sang-Heon Jeon

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

* Re: [PATCH 00/36] treewide: remove conditional returns with no effect
  2026-07-27 11:08     ` Sang-Heon Jeon
@ 2026-07-27 11:36       ` Jani Nikula
  0 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2026-07-27 11:36 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Jakub Kicinski, 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,
	James E.J. Bottomley, 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, 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

On Mon, 27 Jul 2026, Sang-Heon Jeon <ekffu200098@gmail.com> wrote:
> Hello,
>
> On Mon, Jul 27, 2026 at 5:30 PM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>>
>> On Fri, 24 Jul 2026, Jakub Kicinski <kuba@kernel.org> wrote:
>> > On Fri, 24 Jul 2026 03:45:02 +0900 Sang-Heon Jeon wrote:
>> >> 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.
>> >
>> > Huh, I thought we already had such script. Various script children have
>> > been sending such "cleanups" in the past.
>>
>> We did, and it was removed, I believe in 1a617a8475e8 ("coccinelle:
>> misc: remove "complex return code" warnings"), because people just don't
>> want this constant churn.
>>
>> It's perfectly fine to have the error case and happy day scenario
>> separated.
>
> Thanks for sharing the history.
>
> I checked the mailing list. The removed script looks similar to the
> new one, but it is different. The removed script reported a
> conditional return followed by an explicit return 0, where the error
> case and happy day scenario are separated as you mentioned, and Johan
> also complained about this 10 years ago.
>
> But the new script only reports when both branches return the same
> variable, not the explicit 0. So, I think the new script is close to
> the restricted version that Julia mentioned 10 years ago, and it
> should be acceptable.

ret === 0 after an if (ret) return.

BR,
Jani.


>
>>
>> BR,
>> Jani.
>>
>>
>> --
>> Jani Nikula, Intel
>
> Best Regards,
> Sang-Heon Jeon

-- 
Jani Nikula, Intel

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

* Re: [PATCH 00/36] treewide: remove conditional returns 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-24 23:35 ` (subset) " Sebastian Reichel
@ 2026-07-27 12:12 ` Mark Brown
  2026-07-27 12:59   ` Sang-Heon Jeon
  3 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2026-07-27 12:12 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: 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,
	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, 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

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

On Fri, Jul 24, 2026 at 03:45:02AM +0900, Sang-Heon Jeon wrote:

> 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.

Please don't do this, it does not make anything more convenient - it
results in huge CC lists and makes it more difficult to work out who
will actually apply things.  If there's no dependencies just send to
each subsystem independently.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 00/36] treewide: remove conditional returns with no effect
  2026-07-27 12:12 ` Mark Brown
@ 2026-07-27 12:59   ` Sang-Heon Jeon
  0 siblings, 0 replies; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 12:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: 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,
	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, 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

On Mon, Jul 27, 2026 at 9:12 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Jul 24, 2026 at 03:45:02AM +0900, Sang-Heon Jeon wrote:
>
> > 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.
>
> Please don't do this, it does not make anything more convenient - it
> results in huge CC lists and makes it more difficult to work out who
> will actually apply things.  If there's no dependencies just send to
> each subsystem independently.

Thanks for letting me know. I'll keep that in mind. In v2, I will send
the cleanup patches to each subsystem independently.

Best Regards,
Sang-Heon Jeon

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

end of thread, other threads:[~2026-07-27 12:59 UTC | newest]

Thread overview: 10+ 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 12/36] media: remove conditional return " Sang-Heon Jeon
2026-07-23 20:26   ` Niklas Söderlund
2026-07-24 21:48 ` [PATCH 00/36] treewide: remove conditional returns " Jakub Kicinski
2026-07-27  8:30   ` Jani Nikula
2026-07-27 11:08     ` Sang-Heon Jeon
2026-07-27 11:36       ` Jani Nikula
2026-07-24 23:35 ` (subset) " Sebastian Reichel
2026-07-27 12:12 ` Mark Brown
2026-07-27 12:59   ` 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