All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/36] treewide: remove conditional returns with no effect
@ 2026-07-23 18:45 ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [Intel-wired-lan] [PATCH 00/36] treewide: remove conditional returns with no effect
@ 2026-07-23 18:45 ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [cocci] [PATCH 00/36] treewide: remove conditional returns with no effect
@ 2026-07-23 18:45 ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [PATCH 01/36] coccinelle: misc: add cond_return_no_effect.cocci
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Nicolas Palix; +Cc: cocci, linux-kernel

Add a new Coccinelle script which removes a conditional return that
has no effect:

	if (ret)
		return ret;
	return ret;

Both branches return the same value, so the check can be removed.
The condition can also be a negation or a comparison with a
constant. Such code is usually a leftover from removing a
statement between the two returns.

When a local variable is assigned right before the check, the
assignment and the two returns turn into a single return of the
assigned expression, and the declaration is dropped if nothing
else uses the variable. Otherwise only the check is removed.

The fold can delete comments between the check and the final
return, so the generated patch should be reviewed.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 .../misc/cond_return_no_effect.cocci          | 121 ++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 scripts/coccinelle/misc/cond_return_no_effect.cocci

diff --git a/scripts/coccinelle/misc/cond_return_no_effect.cocci b/scripts/coccinelle/misc/cond_return_no_effect.cocci
new file mode 100644
index 000000000000..541aafdc32c6
--- /dev/null
+++ b/scripts/coccinelle/misc/cond_return_no_effect.cocci
@@ -0,0 +1,121 @@
+// SPDX-License-Identifier: GPL-2.0-only
+///
+/// Remove a conditional return that has no effect:
+///
+///	if (ret)
+///		return ret;
+///	return ret;
+///
+/// Both branches return the same variable, so the check has no
+/// effect. It can also be a negation or a comparison with a
+/// constant.
+///
+/// When a local variable is assigned right before the check, the
+/// assignment and the two returns turn into a single return of the
+/// assigned expression, and the declaration is dropped if nothing
+/// else uses the variable. Otherwise only the check is removed.
+///
+// Such code is usually a leftover from removing a statement between
+// the two returns.
+//
+// Confidence: High
+// Copyright: (C) 2026 Sang-Heon Jeon
+// Comments: The fold can delete comments between the check and the
+//           final return, so review the generated patch.
+// Options: --no-includes --include-headers
+
+virtual patch
+virtual context
+virtual org
+virtual report
+
+//----------------------------------------------------------
+//  For patch mode
+//----------------------------------------------------------
+
+@collect depends on patch@
+identifier ret;
+expression E;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+	ret = E;
+	if (\(ret \| !ret \| ret cmp C\))
+		return ret;
+	return ret;
+
+@depends on patch@
+local idexpression ret;
+expression E;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+-	ret = E;
+-	if (\(ret \| !ret \| ret cmp C\))
+-		return ret;
+-	return ret;
++	return E;
+
+@depends on patch@
+idexpression ret;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+-	if (\(ret \| !ret \| ret cmp C\))
+-		return ret;
+	return ret;
+
+@depends on patch@
+type T;
+identifier collect.ret;
+@@
+-	T ret;
+	... when != ret
+	    when strict
+
+@depends on patch@
+type T;
+identifier collect.ret;
+constant C;
+@@
+-	T ret = C;
+	... when != ret
+	    when strict
+
+
+//----------------------------------------------------------
+//  For context mode
+//----------------------------------------------------------
+
+@depends on context@
+idexpression ret;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+*	if (\(ret \| !ret \| ret cmp C\))
+*		return ret;
+	return ret;
+
+//----------------------------------------------------------
+//  For org and report mode
+//----------------------------------------------------------
+
+@r depends on org || report@
+idexpression ret;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+position p;
+@@
+	if@p (\(ret \| !ret \| ret cmp C\))
+		return ret;
+	return ret;
+
+@script:python depends on org@
+p << r.p;
+@@
+cocci.print_main("WARNING: conditional return with no effect (both branches return the same value)", p)
+
+@script:python depends on report@
+p << r.p;
+@@
+coccilib.report.print_report(p[0], "WARNING: conditional return with no effect (both branches return the same value)")
-- 
2.43.0


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

* [cocci] [PATCH 01/36] coccinelle: misc: add cond_return_no_effect.cocci
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Nicolas Palix; +Cc: cocci, linux-kernel

Add a new Coccinelle script which removes a conditional return that
has no effect:

	if (ret)
		return ret;
	return ret;

Both branches return the same value, so the check can be removed.
The condition can also be a negation or a comparison with a
constant. Such code is usually a leftover from removing a
statement between the two returns.

When a local variable is assigned right before the check, the
assignment and the two returns turn into a single return of the
assigned expression, and the declaration is dropped if nothing
else uses the variable. Otherwise only the check is removed.

The fold can delete comments between the check and the final
return, so the generated patch should be reviewed.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 .../misc/cond_return_no_effect.cocci          | 121 ++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 scripts/coccinelle/misc/cond_return_no_effect.cocci

diff --git a/scripts/coccinelle/misc/cond_return_no_effect.cocci b/scripts/coccinelle/misc/cond_return_no_effect.cocci
new file mode 100644
index 000000000000..541aafdc32c6
--- /dev/null
+++ b/scripts/coccinelle/misc/cond_return_no_effect.cocci
@@ -0,0 +1,121 @@
+// SPDX-License-Identifier: GPL-2.0-only
+///
+/// Remove a conditional return that has no effect:
+///
+///	if (ret)
+///		return ret;
+///	return ret;
+///
+/// Both branches return the same variable, so the check has no
+/// effect. It can also be a negation or a comparison with a
+/// constant.
+///
+/// When a local variable is assigned right before the check, the
+/// assignment and the two returns turn into a single return of the
+/// assigned expression, and the declaration is dropped if nothing
+/// else uses the variable. Otherwise only the check is removed.
+///
+// Such code is usually a leftover from removing a statement between
+// the two returns.
+//
+// Confidence: High
+// Copyright: (C) 2026 Sang-Heon Jeon
+// Comments: The fold can delete comments between the check and the
+//           final return, so review the generated patch.
+// Options: --no-includes --include-headers
+
+virtual patch
+virtual context
+virtual org
+virtual report
+
+//----------------------------------------------------------
+//  For patch mode
+//----------------------------------------------------------
+
+@collect depends on patch@
+identifier ret;
+expression E;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+	ret = E;
+	if (\(ret \| !ret \| ret cmp C\))
+		return ret;
+	return ret;
+
+@depends on patch@
+local idexpression ret;
+expression E;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+-	ret = E;
+-	if (\(ret \| !ret \| ret cmp C\))
+-		return ret;
+-	return ret;
++	return E;
+
+@depends on patch@
+idexpression ret;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+-	if (\(ret \| !ret \| ret cmp C\))
+-		return ret;
+	return ret;
+
+@depends on patch@
+type T;
+identifier collect.ret;
+@@
+-	T ret;
+	... when != ret
+	    when strict
+
+@depends on patch@
+type T;
+identifier collect.ret;
+constant C;
+@@
+-	T ret = C;
+	... when != ret
+	    when strict
+
+
+//----------------------------------------------------------
+//  For context mode
+//----------------------------------------------------------
+
+@depends on context@
+idexpression ret;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+@@
+*	if (\(ret \| !ret \| ret cmp C\))
+*		return ret;
+	return ret;
+
+//----------------------------------------------------------
+//  For org and report mode
+//----------------------------------------------------------
+
+@r depends on org || report@
+idexpression ret;
+binary operator cmp = {<, <=, >, >=, ==, !=};
+constant C;
+position p;
+@@
+	if@p (\(ret \| !ret \| ret cmp C\))
+		return ret;
+	return ret;
+
+@script:python depends on org@
+p << r.p;
+@@
+cocci.print_main("WARNING: conditional return with no effect (both branches return the same value)", p)
+
+@script:python depends on report@
+p << r.p;
+@@
+coccilib.report.print_report(p[0], "WARNING: conditional return with no effect (both branches return the same value)")
-- 
2.43.0


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

* [PATCH 02/36] drm/amd: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alex Deucher, Christian König, David Airlie,
	Simona Vetter, Kenneth Feng
  Cc: cocci, amd-gfx, dri-devel, linux-kernel

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/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 ++--------
 28 files changed, 60 insertions(+), 192 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 65b8497ad5f0..c64c79db3016 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4482,11 +4482,7 @@ static int gfx_v7_0_hw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = gfx_v7_0_cp_resume(adev);
-	if (r)
-		return r;
-
-	return r;
+	return gfx_v7_0_cp_resume(adev);
 }
 
 static int gfx_v7_0_hw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 1cad6dc9476e..5baacf86facb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -1614,11 +1614,7 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
 	if (r)
 		return r;
 
-	r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
-	if (r)
-		return r;
-
-	return r;
+	return gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
 }
 
 static u32 gfx_v9_0_get_csb_size(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index 9512fef81d84..22b48f4232b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -599,11 +599,7 @@ static int gfx_v9_4_3_init_microcode(struct amdgpu_device *adev)
 	if (r)
 		return r;
 
-	r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
-	if (r)
-		return r;
-
-	return r;
+	return gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
 }
 
 static void gfx_v9_4_3_mec_fini(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
index 6fe3d3d56c40..4dac16bb330c 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
@@ -1537,11 +1537,7 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v4_4_2_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
index 1ca0e7f65442..5192fe097385 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
@@ -1440,11 +1440,7 @@ static int sdma_v5_0_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v5_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 81f1e9882177..4ddb8277c37d 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -1358,11 +1358,7 @@ static int sdma_v5_2_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v5_2_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
index cf3d2997fff8..d41e3720020f 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
@@ -1406,11 +1406,7 @@ static int sdma_v6_0_sw_init(struct amdgpu_ip_block *ip_block)
 		break;
 	}
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v6_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 8a9ba2276275..004a8ce8eedc 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
@@ -128,11 +128,7 @@ static int uvd_v4_2_sw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_resume(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_resume(adev);
 }
 
 static int uvd_v4_2_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 454f109cbb2e..52700e9048f7 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
@@ -121,11 +121,7 @@ static int uvd_v5_0_sw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_resume(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_resume(adev);
 }
 
 static int uvd_v5_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
index 46222fc30be6..3760a06d8ef2 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
@@ -484,11 +484,7 @@ static int uvd_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = amdgpu_virt_alloc_mm_table(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_virt_alloc_mm_table(adev);
 }
 
 static int uvd_v7_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
index ee445d8abe47..a2f908f86df3 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
@@ -491,11 +491,7 @@ static int vce_v4_0_sw_init(struct amdgpu_ip_block *ip_block)
 			return r;
 	}
 
-	r = amdgpu_virt_alloc_mm_table(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_virt_alloc_mm_table(adev);
 }
 
 static int vce_v4_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
index b763fdf43c60..0d241002df82 100644
--- a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
+++ b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
@@ -1075,16 +1075,12 @@ static int kv_populate_samu_table(struct amdgpu_device *adev)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_kv_copy_bytes_to_smc(adev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, SamuLevel),
-				   (u8 *)&pi->samu_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_kv_copy_bytes_to_smc(adev,
+					   pi->dpm_table_start +
+					   offsetof(SMU7_Fusion_DpmTable, SamuLevel),
+					   (u8 *)&pi->samu_level,
+					   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
+					   pi->sram_end);
 }
 
 
@@ -1134,16 +1130,12 @@ static int kv_populate_acp_table(struct amdgpu_device *adev)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_kv_copy_bytes_to_smc(adev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, AcpLevel),
-				   (u8 *)&pi->acp_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_kv_copy_bytes_to_smc(adev,
+					   pi->dpm_table_start +
+					   offsetof(SMU7_Fusion_DpmTable, AcpLevel),
+					   (u8 *)&pi->acp_level,
+					   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
+					   pi->sram_end);
 }
 
 static void kv_calculate_dfs_bypass_settings(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
index 012227c70600..50973f92ccbf 100644
--- a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
+++ b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
@@ -6989,11 +6989,7 @@ static int si_set_temperature_range(struct amdgpu_device *adev)
 	ret = si_thermal_set_temperature_range(adev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
 	if (ret)
 		return ret;
-	ret = si_thermal_enable_alert(adev, true);
-	if (ret)
-		return ret;
-
-	return ret;
+	return si_thermal_enable_alert(adev, true);
 }
 
 static void si_dpm_disable(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index f4e817885e54..9c2eb6431727 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1922,11 +1922,7 @@ static int smu_start_smc_engine(struct smu_context *smu)
 	 * Send msg GetDriverIfVersion to check if the return value is equal
 	 * with DRIVER_IF_VERSION of smc header.
 	 */
-	ret = smu_check_fw_version(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_check_fw_version(smu);
 }
 
 static int smu_hw_init(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
index db5db2c9c8e8..0dd2dbbfb2cd 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
@@ -540,11 +540,7 @@ static int arcturus_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = arcturus_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return arcturus_check_powerplay_table(smu);
 }
 
 static int arcturus_run_btc(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 8feea44f3ca0..48af342aa549 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -484,11 +484,7 @@ static int navi10_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = navi10_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return navi10_check_powerplay_table(smu);
 }
 
 static int navi10_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index a889d846e9c5..8f35ddaabe88 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -528,12 +528,10 @@ int smu_v11_0_notify_memory_pool_location(struct smu_context *smu)
 					  address_low, NULL);
 	if (ret)
 		return ret;
-	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DramLogSetDramSize,
-					  (uint32_t)memory_pool->size, NULL);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_DramLogSetDramSize,
+					       (uint32_t)memory_pool->size,
+					       NULL);
 }
 
 int smu_v11_0_set_min_deep_sleep_dcefclk(struct smu_context *smu, uint32_t clk)
@@ -1378,13 +1376,8 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 int smu_v11_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 016a5c893fee..3350ea1bea24 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -1368,11 +1368,8 @@ static int vangogh_set_peak_clock_by_device(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = vangogh_set_soft_freq_limited_range(smu, SMU_DCLK, dclk_freq, dclk_freq, false);
-	if (ret)
-		return ret;
-
-	return ret;
+	return vangogh_set_soft_freq_limited_range(smu, SMU_DCLK, dclk_freq,
+						   dclk_freq, false);
 }
 
 static int vangogh_set_performance_level(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 2b011610e3c7..85f77754a0c0 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -893,11 +893,8 @@ static int renoir_set_peak_clock_by_device(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = smu_v12_0_set_soft_freq_limited_range(smu, SMU_UCLK, uclk_freq, uclk_freq, false);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v12_0_set_soft_freq_limited_range(smu, SMU_UCLK, uclk_freq,
+						     uclk_freq, false);
 }
 
 static int renior_set_dpm_profile_freq(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
index cd7bf36673cb..2a74bb8a7b78 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
@@ -533,11 +533,7 @@ static int aldebaran_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = aldebaran_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return aldebaran_check_powerplay_table(smu);
 }
 
 static bool aldebaran_is_primary(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index 4f10bce36756..a2b0a2f23916 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -583,12 +583,10 @@ int smu_v13_0_notify_memory_pool_location(struct smu_context *smu)
 					      address_low, NULL);
 	if (ret)
 		return ret;
-	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DramLogSetDramSize,
-					      (uint32_t)memory_pool->size, NULL);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_DramLogSetDramSize,
+					       (uint32_t)memory_pool->size,
+					       NULL);
 }
 
 int smu_v13_0_set_driver_table_location(struct smu_context *smu)
@@ -1281,13 +1279,8 @@ int smu_v13_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 int smu_v13_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index 4ce1429cf57b..0ca404ccb4a9 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -463,11 +463,7 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
 			return ret;
 	}
 
-	ret = smu_v13_0_0_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v13_0_0_check_powerplay_table(smu);
 }
 
 static int smu_v13_0_0_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
index 64db62a8d642..b55626f61be7 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
@@ -1893,7 +1893,6 @@ static int smu_v13_0_6_register_irq_handler(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	struct amdgpu_irq_src *irq_src = &smu->irq_source;
-	int ret = 0;
 
 	if (amdgpu_sriov_vf(adev))
 		return 0;
@@ -1901,13 +1900,8 @@ static int smu_v13_0_6_register_irq_handler(struct smu_context *smu)
 	irq_src->num_types = 1;
 	irq_src->funcs = &smu_v13_0_6_irq_funcs;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v13_0_6_notify_unload(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
index 5f23f2e7f401..0cc3ec648521 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
@@ -499,11 +499,7 @@ static int smu_v13_0_7_setup_pptable(struct smu_context *smu)
 			return ret;
 	}
 
-	ret = smu_v13_0_7_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v13_0_7_check_powerplay_table(smu);
 }
 
 static int smu_v13_0_7_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
index 2a0c7cde938d..27a3f5d9cba6 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
@@ -549,12 +549,10 @@ int smu_v14_0_notify_memory_pool_location(struct smu_context *smu)
 					      address_low, NULL);
 	if (ret)
 		return ret;
-	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DramLogSetDramSize,
-					      (uint32_t)memory_pool->size, NULL);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_DramLogSetDramSize,
+					       (uint32_t)memory_pool->size,
+					       NULL);
 }
 
 int smu_v14_0_set_driver_table_location(struct smu_context *smu)
@@ -911,13 +909,8 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v14_0_wait_for_reset_complete(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
index 0fbcaf884419..0aec08200038 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
@@ -366,11 +366,7 @@ static int smu_v14_0_2_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = smu_v14_0_2_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v14_0_2_check_powerplay_table(smu);
 }
 
 static int smu_v14_0_2_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c
index 046069e93854..cb1602cfab98 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c
@@ -782,13 +782,8 @@ int smu_v15_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v15_0_wait_for_reset_complete(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
index 227cd86e13e8..b398e1606177 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
@@ -318,11 +318,7 @@ static int smu_v15_0_8_fini_smc_tables(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = smu_v15_0_fini_smc_tables(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v15_0_fini_smc_tables(smu);
 }
 
 static int smu_v15_0_8_init_allowed_features(struct smu_context *smu)
@@ -1253,7 +1249,6 @@ static int smu_v15_0_8_register_irq_handler(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	struct amdgpu_irq_src *irq_src = &smu->irq_source;
-	int ret = 0;
 
 	if (amdgpu_sriov_vf(adev))
 		return 0;
@@ -1261,13 +1256,8 @@ static int smu_v15_0_8_register_irq_handler(struct smu_context *smu)
 	irq_src->num_types = 1;
 	irq_src->funcs = &smu_v15_0_8_irq_funcs;
 
-	ret = amdgpu_irq_add_id(adev, SOC_V1_0_IH_CLIENTID_MP1,
-				IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC_V1_0_IH_CLIENTID_MP1,
+				 IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v15_0_8_notify_unload(struct smu_context *smu)
-- 
2.43.0


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

* [cocci] [PATCH 02/36] drm/amd: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alex Deucher, Christian König, David Airlie,
	Simona Vetter, Kenneth Feng
  Cc: cocci, amd-gfx, dri-devel, linux-kernel

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/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 ++--------
 28 files changed, 60 insertions(+), 192 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 65b8497ad5f0..c64c79db3016 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4482,11 +4482,7 @@ static int gfx_v7_0_hw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = gfx_v7_0_cp_resume(adev);
-	if (r)
-		return r;
-
-	return r;
+	return gfx_v7_0_cp_resume(adev);
 }
 
 static int gfx_v7_0_hw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 1cad6dc9476e..5baacf86facb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -1614,11 +1614,7 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
 	if (r)
 		return r;
 
-	r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
-	if (r)
-		return r;
-
-	return r;
+	return gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
 }
 
 static u32 gfx_v9_0_get_csb_size(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index 9512fef81d84..22b48f4232b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -599,11 +599,7 @@ static int gfx_v9_4_3_init_microcode(struct amdgpu_device *adev)
 	if (r)
 		return r;
 
-	r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
-	if (r)
-		return r;
-
-	return r;
+	return gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
 }
 
 static void gfx_v9_4_3_mec_fini(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
index 6fe3d3d56c40..4dac16bb330c 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
@@ -1537,11 +1537,7 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v4_4_2_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
index 1ca0e7f65442..5192fe097385 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
@@ -1440,11 +1440,7 @@ static int sdma_v5_0_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v5_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 81f1e9882177..4ddb8277c37d 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -1358,11 +1358,7 @@ static int sdma_v5_2_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v5_2_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
index cf3d2997fff8..d41e3720020f 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
@@ -1406,11 +1406,7 @@ static int sdma_v6_0_sw_init(struct amdgpu_ip_block *ip_block)
 		break;
 	}
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_sdma_sysfs_reset_mask_init(adev);
 }
 
 static int sdma_v6_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 8a9ba2276275..004a8ce8eedc 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
@@ -128,11 +128,7 @@ static int uvd_v4_2_sw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_resume(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_resume(adev);
 }
 
 static int uvd_v4_2_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 454f109cbb2e..52700e9048f7 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
@@ -121,11 +121,7 @@ static int uvd_v5_0_sw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_resume(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_resume(adev);
 }
 
 static int uvd_v5_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
index 46222fc30be6..3760a06d8ef2 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
@@ -484,11 +484,7 @@ static int uvd_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	r = amdgpu_virt_alloc_mm_table(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_virt_alloc_mm_table(adev);
 }
 
 static int uvd_v7_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
index ee445d8abe47..a2f908f86df3 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
@@ -491,11 +491,7 @@ static int vce_v4_0_sw_init(struct amdgpu_ip_block *ip_block)
 			return r;
 	}
 
-	r = amdgpu_virt_alloc_mm_table(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_virt_alloc_mm_table(adev);
 }
 
 static int vce_v4_0_sw_fini(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
index b763fdf43c60..0d241002df82 100644
--- a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
+++ b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
@@ -1075,16 +1075,12 @@ static int kv_populate_samu_table(struct amdgpu_device *adev)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_kv_copy_bytes_to_smc(adev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, SamuLevel),
-				   (u8 *)&pi->samu_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_kv_copy_bytes_to_smc(adev,
+					   pi->dpm_table_start +
+					   offsetof(SMU7_Fusion_DpmTable, SamuLevel),
+					   (u8 *)&pi->samu_level,
+					   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
+					   pi->sram_end);
 }
 
 
@@ -1134,16 +1130,12 @@ static int kv_populate_acp_table(struct amdgpu_device *adev)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_kv_copy_bytes_to_smc(adev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, AcpLevel),
-				   (u8 *)&pi->acp_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_kv_copy_bytes_to_smc(adev,
+					   pi->dpm_table_start +
+					   offsetof(SMU7_Fusion_DpmTable, AcpLevel),
+					   (u8 *)&pi->acp_level,
+					   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
+					   pi->sram_end);
 }
 
 static void kv_calculate_dfs_bypass_settings(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
index 012227c70600..50973f92ccbf 100644
--- a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
+++ b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
@@ -6989,11 +6989,7 @@ static int si_set_temperature_range(struct amdgpu_device *adev)
 	ret = si_thermal_set_temperature_range(adev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
 	if (ret)
 		return ret;
-	ret = si_thermal_enable_alert(adev, true);
-	if (ret)
-		return ret;
-
-	return ret;
+	return si_thermal_enable_alert(adev, true);
 }
 
 static void si_dpm_disable(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index f4e817885e54..9c2eb6431727 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1922,11 +1922,7 @@ static int smu_start_smc_engine(struct smu_context *smu)
 	 * Send msg GetDriverIfVersion to check if the return value is equal
 	 * with DRIVER_IF_VERSION of smc header.
 	 */
-	ret = smu_check_fw_version(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_check_fw_version(smu);
 }
 
 static int smu_hw_init(struct amdgpu_ip_block *ip_block)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
index db5db2c9c8e8..0dd2dbbfb2cd 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
@@ -540,11 +540,7 @@ static int arcturus_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = arcturus_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return arcturus_check_powerplay_table(smu);
 }
 
 static int arcturus_run_btc(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 8feea44f3ca0..48af342aa549 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -484,11 +484,7 @@ static int navi10_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = navi10_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return navi10_check_powerplay_table(smu);
 }
 
 static int navi10_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index a889d846e9c5..8f35ddaabe88 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -528,12 +528,10 @@ int smu_v11_0_notify_memory_pool_location(struct smu_context *smu)
 					  address_low, NULL);
 	if (ret)
 		return ret;
-	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DramLogSetDramSize,
-					  (uint32_t)memory_pool->size, NULL);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_DramLogSetDramSize,
+					       (uint32_t)memory_pool->size,
+					       NULL);
 }
 
 int smu_v11_0_set_min_deep_sleep_dcefclk(struct smu_context *smu, uint32_t clk)
@@ -1378,13 +1376,8 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 int smu_v11_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 016a5c893fee..3350ea1bea24 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -1368,11 +1368,8 @@ static int vangogh_set_peak_clock_by_device(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = vangogh_set_soft_freq_limited_range(smu, SMU_DCLK, dclk_freq, dclk_freq, false);
-	if (ret)
-		return ret;
-
-	return ret;
+	return vangogh_set_soft_freq_limited_range(smu, SMU_DCLK, dclk_freq,
+						   dclk_freq, false);
 }
 
 static int vangogh_set_performance_level(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 2b011610e3c7..85f77754a0c0 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -893,11 +893,8 @@ static int renoir_set_peak_clock_by_device(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = smu_v12_0_set_soft_freq_limited_range(smu, SMU_UCLK, uclk_freq, uclk_freq, false);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v12_0_set_soft_freq_limited_range(smu, SMU_UCLK, uclk_freq,
+						     uclk_freq, false);
 }
 
 static int renior_set_dpm_profile_freq(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
index cd7bf36673cb..2a74bb8a7b78 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
@@ -533,11 +533,7 @@ static int aldebaran_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = aldebaran_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return aldebaran_check_powerplay_table(smu);
 }
 
 static bool aldebaran_is_primary(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index 4f10bce36756..a2b0a2f23916 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -583,12 +583,10 @@ int smu_v13_0_notify_memory_pool_location(struct smu_context *smu)
 					      address_low, NULL);
 	if (ret)
 		return ret;
-	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DramLogSetDramSize,
-					      (uint32_t)memory_pool->size, NULL);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_DramLogSetDramSize,
+					       (uint32_t)memory_pool->size,
+					       NULL);
 }
 
 int smu_v13_0_set_driver_table_location(struct smu_context *smu)
@@ -1281,13 +1279,8 @@ int smu_v13_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 int smu_v13_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index 4ce1429cf57b..0ca404ccb4a9 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -463,11 +463,7 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
 			return ret;
 	}
 
-	ret = smu_v13_0_0_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v13_0_0_check_powerplay_table(smu);
 }
 
 static int smu_v13_0_0_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
index 64db62a8d642..b55626f61be7 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
@@ -1893,7 +1893,6 @@ static int smu_v13_0_6_register_irq_handler(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	struct amdgpu_irq_src *irq_src = &smu->irq_source;
-	int ret = 0;
 
 	if (amdgpu_sriov_vf(adev))
 		return 0;
@@ -1901,13 +1900,8 @@ static int smu_v13_0_6_register_irq_handler(struct smu_context *smu)
 	irq_src->num_types = 1;
 	irq_src->funcs = &smu_v13_0_6_irq_funcs;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v13_0_6_notify_unload(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
index 5f23f2e7f401..0cc3ec648521 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
@@ -499,11 +499,7 @@ static int smu_v13_0_7_setup_pptable(struct smu_context *smu)
 			return ret;
 	}
 
-	ret = smu_v13_0_7_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v13_0_7_check_powerplay_table(smu);
 }
 
 static int smu_v13_0_7_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
index 2a0c7cde938d..27a3f5d9cba6 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
@@ -549,12 +549,10 @@ int smu_v14_0_notify_memory_pool_location(struct smu_context *smu)
 					      address_low, NULL);
 	if (ret)
 		return ret;
-	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DramLogSetDramSize,
-					      (uint32_t)memory_pool->size, NULL);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_DramLogSetDramSize,
+					       (uint32_t)memory_pool->size,
+					       NULL);
 }
 
 int smu_v14_0_set_driver_table_location(struct smu_context *smu)
@@ -911,13 +909,8 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v14_0_wait_for_reset_complete(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
index 0fbcaf884419..0aec08200038 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
@@ -366,11 +366,7 @@ static int smu_v14_0_2_setup_pptable(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = smu_v14_0_2_check_powerplay_table(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v14_0_2_check_powerplay_table(smu);
 }
 
 static int smu_v14_0_2_tables_init(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c
index 046069e93854..cb1602cfab98 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c
@@ -782,13 +782,8 @@ int smu_v15_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
-				SMU_IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				 SMU_IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v15_0_wait_for_reset_complete(struct smu_context *smu,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
index 227cd86e13e8..b398e1606177 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
@@ -318,11 +318,7 @@ static int smu_v15_0_8_fini_smc_tables(struct smu_context *smu)
 	if (ret)
 		return ret;
 
-	ret = smu_v15_0_fini_smc_tables(smu);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v15_0_fini_smc_tables(smu);
 }
 
 static int smu_v15_0_8_init_allowed_features(struct smu_context *smu)
@@ -1253,7 +1249,6 @@ static int smu_v15_0_8_register_irq_handler(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	struct amdgpu_irq_src *irq_src = &smu->irq_source;
-	int ret = 0;
 
 	if (amdgpu_sriov_vf(adev))
 		return 0;
@@ -1261,13 +1256,8 @@ static int smu_v15_0_8_register_irq_handler(struct smu_context *smu)
 	irq_src->num_types = 1;
 	irq_src->funcs = &smu_v15_0_8_irq_funcs;
 
-	ret = amdgpu_irq_add_id(adev, SOC_V1_0_IH_CLIENTID_MP1,
-				IH_INTERRUPT_ID_TO_DRIVER,
-				irq_src);
-	if (ret)
-		return ret;
-
-	return ret;
+	return amdgpu_irq_add_id(adev, SOC_V1_0_IH_CLIENTID_MP1,
+				 IH_INTERRUPT_ID_TO_DRIVER, irq_src);
 }
 
 static int smu_v15_0_8_notify_unload(struct smu_context *smu)
-- 
2.43.0


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

* [PATCH 03/36] drm/radeon: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alex Deucher, Christian König, David Airlie,
	Simona Vetter
  Cc: cocci, amd-gfx, dri-devel, linux-kernel

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/gpu/drm/radeon/ci_dpm.c |  6 +-----
 drivers/gpu/drm/radeon/kv_dpm.c | 30 ++++++++++--------------------
 drivers/gpu/drm/radeon/si_dpm.c | 14 ++------------
 3 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 703848fac189..11707f5aaa6b 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -5244,11 +5244,7 @@ static int ci_set_temperature_range(struct radeon_device *rdev)
 	ret = ci_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
 	if (ret)
 		return ret;
-	ret = ci_thermal_enable_alert(rdev, true);
-	if (ret)
-		return ret;
-
-	return ret;
+	return ci_thermal_enable_alert(rdev, true);
 }
 
 int ci_dpm_late_enable(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 1693b36fc52d..fc5252ff2a26 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -843,16 +843,11 @@ static int kv_populate_samu_table(struct radeon_device *rdev)
 	if (ret)
 		return ret;
 
-	ret = kv_copy_bytes_to_smc(rdev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, SamuLevel),
-				   (u8 *)&pi->samu_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return kv_copy_bytes_to_smc(rdev,
+				    pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, SamuLevel),
+				    (u8 *)&pi->samu_level,
+				    sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
+				    pi->sram_end);
 }
 
 
@@ -902,16 +897,11 @@ static int kv_populate_acp_table(struct radeon_device *rdev)
 	if (ret)
 		return ret;
 
-	ret = kv_copy_bytes_to_smc(rdev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, AcpLevel),
-				   (u8 *)&pi->acp_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return kv_copy_bytes_to_smc(rdev,
+				    pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, AcpLevel),
+				    (u8 *)&pi->acp_level,
+				    sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
+				    pi->sram_end);
 }
 
 static void kv_calculate_dfs_bypass_settings(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 4b10715f951c..4323f86000ac 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -6418,22 +6418,12 @@ static int si_set_temperature_range(struct radeon_device *rdev)
 	ret = si_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
 	if (ret)
 		return ret;
-	ret = si_thermal_enable_alert(rdev, true);
-	if (ret)
-		return ret;
-
-	return ret;
+	return si_thermal_enable_alert(rdev, true);
 }
 
 int si_dpm_late_enable(struct radeon_device *rdev)
 {
-	int ret;
-
-	ret = si_set_temperature_range(rdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return si_set_temperature_range(rdev);
 }
 
 void si_dpm_disable(struct radeon_device *rdev)
-- 
2.43.0


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

* [cocci] [PATCH 03/36] drm/radeon: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alex Deucher, Christian König, David Airlie,
	Simona Vetter
  Cc: cocci, amd-gfx, dri-devel, linux-kernel

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/gpu/drm/radeon/ci_dpm.c |  6 +-----
 drivers/gpu/drm/radeon/kv_dpm.c | 30 ++++++++++--------------------
 drivers/gpu/drm/radeon/si_dpm.c | 14 ++------------
 3 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 703848fac189..11707f5aaa6b 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -5244,11 +5244,7 @@ static int ci_set_temperature_range(struct radeon_device *rdev)
 	ret = ci_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
 	if (ret)
 		return ret;
-	ret = ci_thermal_enable_alert(rdev, true);
-	if (ret)
-		return ret;
-
-	return ret;
+	return ci_thermal_enable_alert(rdev, true);
 }
 
 int ci_dpm_late_enable(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 1693b36fc52d..fc5252ff2a26 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -843,16 +843,11 @@ static int kv_populate_samu_table(struct radeon_device *rdev)
 	if (ret)
 		return ret;
 
-	ret = kv_copy_bytes_to_smc(rdev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, SamuLevel),
-				   (u8 *)&pi->samu_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return kv_copy_bytes_to_smc(rdev,
+				    pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, SamuLevel),
+				    (u8 *)&pi->samu_level,
+				    sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_SAMU,
+				    pi->sram_end);
 }
 
 
@@ -902,16 +897,11 @@ static int kv_populate_acp_table(struct radeon_device *rdev)
 	if (ret)
 		return ret;
 
-	ret = kv_copy_bytes_to_smc(rdev,
-				   pi->dpm_table_start +
-				   offsetof(SMU7_Fusion_DpmTable, AcpLevel),
-				   (u8 *)&pi->acp_level,
-				   sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
-				   pi->sram_end);
-	if (ret)
-		return ret;
-
-	return ret;
+	return kv_copy_bytes_to_smc(rdev,
+				    pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, AcpLevel),
+				    (u8 *)&pi->acp_level,
+				    sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_ACP,
+				    pi->sram_end);
 }
 
 static void kv_calculate_dfs_bypass_settings(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 4b10715f951c..4323f86000ac 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -6418,22 +6418,12 @@ static int si_set_temperature_range(struct radeon_device *rdev)
 	ret = si_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
 	if (ret)
 		return ret;
-	ret = si_thermal_enable_alert(rdev, true);
-	if (ret)
-		return ret;
-
-	return ret;
+	return si_thermal_enable_alert(rdev, true);
 }
 
 int si_dpm_late_enable(struct radeon_device *rdev)
 {
-	int ret;
-
-	ret = si_set_temperature_range(rdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return si_set_temperature_range(rdev);
 }
 
 void si_dpm_disable(struct radeon_device *rdev)
-- 
2.43.0


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

* [PATCH 04/36] dpll: zl3073x: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [cocci] [PATCH 04/36] dpll: zl3073x: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [PATCH 05/36] drm/i915: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Jani Nikula, Rodrigo Vivi, Joonas Lahtinen,
	Tvrtko Ursulin, David Airlie, Simona Vetter
  Cc: cocci, dri-devel, intel-gfx, intel-xe, linux-kernel, Zhenyu Wang,
	Zhi Wang

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/gpu/drm/i915/display/intel_hdmi.c | 7 +------
 drivers/gpu/drm/i915/gvt/gtt.c            | 8 ++------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 8a019d3574df..90880be63a1e 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -2658,13 +2658,8 @@ static int
 intel_hdmi_connector_register(struct drm_connector *_connector)
 {
 	struct intel_connector *connector = to_intel_connector(_connector);
-	int ret;
 
-	ret = intel_connector_register(&connector->base);
-	if (ret)
-		return ret;
-
-	return ret;
+	return intel_connector_register(&connector->base);
 }
 
 static void intel_hdmi_connector_unregister(struct drm_connector *_connector)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index 5056a5887b31..6bca40128d99 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -725,15 +725,11 @@ static int ppgtt_write_protection_handler(
 {
 	struct intel_vgpu_ppgtt_spt *spt = page_track->priv_data;
 
-	int ret;
-
 	if (bytes != 4 && bytes != 8)
 		return -EINVAL;
 
-	ret = ppgtt_handle_guest_write_page_table_bytes(spt, gpa, data, bytes);
-	if (ret)
-		return ret;
-	return ret;
+	return ppgtt_handle_guest_write_page_table_bytes(spt, gpa, data,
+							 bytes);
 }
 
 /* Find a spt by guest gfn. */
-- 
2.43.0


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

* [cocci] [PATCH 05/36] drm/i915: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Jani Nikula, Rodrigo Vivi, Joonas Lahtinen,
	Tvrtko Ursulin, David Airlie, Simona Vetter
  Cc: cocci, dri-devel, intel-gfx, intel-xe, linux-kernel, Zhenyu Wang,
	Zhi Wang

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/gpu/drm/i915/display/intel_hdmi.c | 7 +------
 drivers/gpu/drm/i915/gvt/gtt.c            | 8 ++------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 8a019d3574df..90880be63a1e 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -2658,13 +2658,8 @@ static int
 intel_hdmi_connector_register(struct drm_connector *_connector)
 {
 	struct intel_connector *connector = to_intel_connector(_connector);
-	int ret;
 
-	ret = intel_connector_register(&connector->base);
-	if (ret)
-		return ret;
-
-	return ret;
+	return intel_connector_register(&connector->base);
 }
 
 static void intel_hdmi_connector_unregister(struct drm_connector *_connector)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index 5056a5887b31..6bca40128d99 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -725,15 +725,11 @@ static int ppgtt_write_protection_handler(
 {
 	struct intel_vgpu_ppgtt_spt *spt = page_track->priv_data;
 
-	int ret;
-
 	if (bytes != 4 && bytes != 8)
 		return -EINVAL;
 
-	ret = ppgtt_handle_guest_write_page_table_bytes(spt, gpa, data, bytes);
-	if (ret)
-		return ret;
-	return ret;
+	return ppgtt_handle_guest_write_page_table_bytes(spt, gpa, data,
+							 bytes);
 }
 
 /* Find a spt by guest gfn. */
-- 
2.43.0


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

* [PATCH 06/36] drm: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Philipp Zabel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Frank Li,
	Sascha Hauer, Lyude Paul, Danilo Krummrich, Neil Armstrong,
	Jyri Sarha, Tomi Valkeinen
  Cc: cocci, dri-devel, Fabio Estevam, imx, Jessica Zhang,
	linux-arm-kernel, linux-kernel, nouveau, Pengutronix Kernel Team

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/gpu/drm/imx/ipuv3/imx-drm-core.c           |  6 +-----
 drivers/gpu/drm/nouveau/dispnv50/disp.c            | 14 +++++---------
 drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c |  7 +------
 drivers/gpu/drm/tilcdc/tilcdc_drv.c                |  6 +-----
 4 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c b/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c
index 51a0ec043248..52a2334be799 100644
--- a/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c
@@ -55,11 +55,7 @@ static int imx_drm_atomic_check(struct drm_device *dev,
 		return ret;
 
 	/* Assign PRG/PRE channels and check if all constrains are satisfied. */
-	ret = ipu_planes_assign_pre(dev, state);
-	if (ret)
-		return ret;
-
-	return ret;
+	return ipu_planes_assign_pre(dev, state);
 }
 
 static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 364227f5456f..e8fde399acae 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -301,19 +301,15 @@ nv50_dmac_create(struct nouveau_drm *drm,
 	if (ret)
 		return ret;
 
-	ret = nvif_object_ctor(&dmac->base.user, "kmsVramCtxDma", NV50_DISP_HANDLE_VRAM,
-			       NV_DMA_IN_MEMORY,
-			       &(struct nv_dma_v0) {
+	return nvif_object_ctor(&dmac->base.user, "kmsVramCtxDma", NV50_DISP_HANDLE_VRAM,
+				NV_DMA_IN_MEMORY,
+				&(struct nv_dma_v0) {
 					.target = NV_DMA_V0_TARGET_VRAM,
 					.access = NV_DMA_V0_ACCESS_RDWR,
 					.start = 0,
 					.limit = device->info.ram_user - 1,
-			       }, sizeof(struct nv_dma_v0),
-			       &dmac->vram);
-	if (ret)
-		return ret;
-
-	return ret;
+				}, sizeof(struct nv_dma_v0),
+				&dmac->vram);
 }
 
 /******************************************************************************
diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
index 2334b77f348c..16a02527285e 100644
--- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
+++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
@@ -58,13 +58,8 @@ static int osd101t2587_panel_prepare(struct drm_panel *panel)
 static int osd101t2587_panel_enable(struct drm_panel *panel)
 {
 	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
-	int ret;
 
-	ret = mipi_dsi_turn_on_peripheral(osd101t2587->dsi);
-	if (ret)
-		return ret;
-
-	return ret;
+	return mipi_dsi_turn_on_peripheral(osd101t2587->dsi);
 }
 
 static const struct drm_display_mode default_mode_osd101t2587 = {
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 1d6c9a423a41..990805f1fea6 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -64,11 +64,7 @@ static int tilcdc_atomic_check(struct drm_device *dev,
 	 * tilcdc ->atomic_check can update ->mode_changed if pixel format
 	 * changes, hence will we check modeset changes again.
 	 */
-	ret = drm_atomic_helper_check_modeset(dev, state);
-	if (ret)
-		return ret;
-
-	return ret;
+	return drm_atomic_helper_check_modeset(dev, state);
 }
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
-- 
2.43.0


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

* [cocci] [PATCH 06/36] drm: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Philipp Zabel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Frank Li,
	Sascha Hauer, Lyude Paul, Danilo Krummrich, Neil Armstrong,
	Jyri Sarha, Tomi Valkeinen
  Cc: cocci, dri-devel, Fabio Estevam, imx, Jessica Zhang,
	linux-arm-kernel, linux-kernel, nouveau, Pengutronix Kernel Team

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/gpu/drm/imx/ipuv3/imx-drm-core.c           |  6 +-----
 drivers/gpu/drm/nouveau/dispnv50/disp.c            | 14 +++++---------
 drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c |  7 +------
 drivers/gpu/drm/tilcdc/tilcdc_drv.c                |  6 +-----
 4 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c b/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c
index 51a0ec043248..52a2334be799 100644
--- a/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/ipuv3/imx-drm-core.c
@@ -55,11 +55,7 @@ static int imx_drm_atomic_check(struct drm_device *dev,
 		return ret;
 
 	/* Assign PRG/PRE channels and check if all constrains are satisfied. */
-	ret = ipu_planes_assign_pre(dev, state);
-	if (ret)
-		return ret;
-
-	return ret;
+	return ipu_planes_assign_pre(dev, state);
 }
 
 static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 364227f5456f..e8fde399acae 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -301,19 +301,15 @@ nv50_dmac_create(struct nouveau_drm *drm,
 	if (ret)
 		return ret;
 
-	ret = nvif_object_ctor(&dmac->base.user, "kmsVramCtxDma", NV50_DISP_HANDLE_VRAM,
-			       NV_DMA_IN_MEMORY,
-			       &(struct nv_dma_v0) {
+	return nvif_object_ctor(&dmac->base.user, "kmsVramCtxDma", NV50_DISP_HANDLE_VRAM,
+				NV_DMA_IN_MEMORY,
+				&(struct nv_dma_v0) {
 					.target = NV_DMA_V0_TARGET_VRAM,
 					.access = NV_DMA_V0_ACCESS_RDWR,
 					.start = 0,
 					.limit = device->info.ram_user - 1,
-			       }, sizeof(struct nv_dma_v0),
-			       &dmac->vram);
-	if (ret)
-		return ret;
-
-	return ret;
+				}, sizeof(struct nv_dma_v0),
+				&dmac->vram);
 }
 
 /******************************************************************************
diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
index 2334b77f348c..16a02527285e 100644
--- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
+++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
@@ -58,13 +58,8 @@ static int osd101t2587_panel_prepare(struct drm_panel *panel)
 static int osd101t2587_panel_enable(struct drm_panel *panel)
 {
 	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
-	int ret;
 
-	ret = mipi_dsi_turn_on_peripheral(osd101t2587->dsi);
-	if (ret)
-		return ret;
-
-	return ret;
+	return mipi_dsi_turn_on_peripheral(osd101t2587->dsi);
 }
 
 static const struct drm_display_mode default_mode_osd101t2587 = {
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 1d6c9a423a41..990805f1fea6 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -64,11 +64,7 @@ static int tilcdc_atomic_check(struct drm_device *dev,
 	 * tilcdc ->atomic_check can update ->mode_changed if pixel format
 	 * changes, hence will we check modeset changes again.
 	 */
-	ret = drm_atomic_helper_check_modeset(dev, state);
-	if (ret)
-		return ret;
-
-	return ret;
+	return drm_atomic_helper_check_modeset(dev, state);
 }
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
-- 
2.43.0


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

* [PATCH 07/36] net: ethernet: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [cocci] [PATCH 07/36] net: ethernet: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [PATCH 08/36] net: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [cocci] [PATCH 08/36] net: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [Intel-wired-lan] [PATCH 09/36] net: intel: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
  (?)
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [PATCH 09/36] net: intel: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [cocci] [PATCH 09/36] net: intel: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [PATCH 10/36] wifi: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Miri Korenblit, Ping-Ke Shih
  Cc: cocci, linux-kernel, linux-wireless

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/wireless/ath/ath6kl/init.c              | 6 +-----
 drivers/net/wireless/intel/iwlwifi/mvm/link.c       | 6 +-----
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 7 +------
 drivers/net/wireless/realtek/rtw89/mac.c            | 6 +-----
 drivers/net/wireless/realtek/rtw89/mac_be.c         | 6 +-----
 5 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 782209dcb782..61fa10d88714 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1566,11 +1566,7 @@ static int ath6kl_init_upload(struct ath6kl *ar)
 
 	address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS;
 	param = options | 0x20;
-	status = ath6kl_bmi_reg_write(ar, address, param);
-	if (status)
-		return status;
-
-	return status;
+	return ath6kl_bmi_reg_write(ar, address, param);
 }
 
 int ath6kl_init_hw_params(struct ath6kl *ar)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
index b5d252ece2d9..76a548f9aea2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
@@ -278,11 +278,7 @@ int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	if (ret)
 		return ret;
 
-	ret = iwl_mvm_remove_link(mvm, vif, link_conf);
-	if (ret)
-		return ret;
-
-	return ret;
+	return iwl_mvm_remove_link(mvm, vif, link_conf);
 }
 
 void iwl_mvm_init_link(struct iwl_mvm_vif_link_info *link)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 9b119a51bc30..1ba53e671207 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -1462,12 +1462,7 @@ static bool _rtl8821ae_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
 			return status;
 	}
 
-	status = _rtl8821ae_llt_write(hw, last_entry_of_txpktbuf,
-				      txpktbuf_bndy);
-	if (!status)
-		return status;
-
-	return status;
+	return _rtl8821ae_llt_write(hw, last_entry_of_txpktbuf, txpktbuf_bndy);
 }
 
 static bool _rtl8821ae_dynamic_rqpn(struct ieee80211_hw *hw, u32 boundary,
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index 8c395517bd2f..967b42f2b6fb 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -1706,11 +1706,7 @@ static int sys_init_ax(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	ret = chip_func_en_ax(rtwdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return chip_func_en_ax(rtwdev);
 }
 
 const struct rtw89_mac_size_set rtw89_mac_size = {
diff --git a/drivers/net/wireless/realtek/rtw89/mac_be.c b/drivers/net/wireless/realtek/rtw89/mac_be.c
index f24c119b99f1..b7ba8de9cc78 100644
--- a/drivers/net/wireless/realtek/rtw89/mac_be.c
+++ b/drivers/net/wireless/realtek/rtw89/mac_be.c
@@ -924,11 +924,7 @@ static int sys_init_be(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	ret = chip_func_en_be(rtwdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return chip_func_en_be(rtwdev);
 }
 
 static int mac_func_en_be(struct rtw89_dev *rtwdev)
-- 
2.43.0


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

* [cocci] [PATCH 10/36] wifi: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Miri Korenblit, Ping-Ke Shih
  Cc: cocci, linux-kernel, linux-wireless

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/wireless/ath/ath6kl/init.c              | 6 +-----
 drivers/net/wireless/intel/iwlwifi/mvm/link.c       | 6 +-----
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 7 +------
 drivers/net/wireless/realtek/rtw89/mac.c            | 6 +-----
 drivers/net/wireless/realtek/rtw89/mac_be.c         | 6 +-----
 5 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 782209dcb782..61fa10d88714 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1566,11 +1566,7 @@ static int ath6kl_init_upload(struct ath6kl *ar)
 
 	address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS;
 	param = options | 0x20;
-	status = ath6kl_bmi_reg_write(ar, address, param);
-	if (status)
-		return status;
-
-	return status;
+	return ath6kl_bmi_reg_write(ar, address, param);
 }
 
 int ath6kl_init_hw_params(struct ath6kl *ar)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
index b5d252ece2d9..76a548f9aea2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
@@ -278,11 +278,7 @@ int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	if (ret)
 		return ret;
 
-	ret = iwl_mvm_remove_link(mvm, vif, link_conf);
-	if (ret)
-		return ret;
-
-	return ret;
+	return iwl_mvm_remove_link(mvm, vif, link_conf);
 }
 
 void iwl_mvm_init_link(struct iwl_mvm_vif_link_info *link)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 9b119a51bc30..1ba53e671207 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -1462,12 +1462,7 @@ static bool _rtl8821ae_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
 			return status;
 	}
 
-	status = _rtl8821ae_llt_write(hw, last_entry_of_txpktbuf,
-				      txpktbuf_bndy);
-	if (!status)
-		return status;
-
-	return status;
+	return _rtl8821ae_llt_write(hw, last_entry_of_txpktbuf, txpktbuf_bndy);
 }
 
 static bool _rtl8821ae_dynamic_rqpn(struct ieee80211_hw *hw, u32 boundary,
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index 8c395517bd2f..967b42f2b6fb 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -1706,11 +1706,7 @@ static int sys_init_ax(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	ret = chip_func_en_ax(rtwdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return chip_func_en_ax(rtwdev);
 }
 
 const struct rtw89_mac_size_set rtw89_mac_size = {
diff --git a/drivers/net/wireless/realtek/rtw89/mac_be.c b/drivers/net/wireless/realtek/rtw89/mac_be.c
index f24c119b99f1..b7ba8de9cc78 100644
--- a/drivers/net/wireless/realtek/rtw89/mac_be.c
+++ b/drivers/net/wireless/realtek/rtw89/mac_be.c
@@ -924,11 +924,7 @@ static int sys_init_be(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	ret = chip_func_en_be(rtwdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return chip_func_en_be(rtwdev);
 }
 
 static int mac_func_en_be(struct rtw89_dev *rtwdev)
-- 
2.43.0


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

* [PATCH 11/36] ipvs: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [cocci] [PATCH 11/36] ipvs: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [PATCH 12/36] media: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [cocci] [PATCH 12/36] media: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* [PATCH 13/36] ALSA: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Jaroslav Kysela, Takashi Iwai
  Cc: cocci, linux-kernel, linux-sound

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>
---
 sound/pci/echoaudio/echoaudio_dsp.c |  6 +-----
 sound/pci/echoaudio/layla24_dsp.c   |  6 +-----
 sound/pci/riptide/riptide.c         |  5 +----
 sound/usb/mixer_scarlett.c          | 26 ++++++++++----------------
 4 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c
index 4dd494508c9b..90d7f364d2b3 100644
--- a/sound/pci/echoaudio/echoaudio_dsp.c
+++ b/sound/pci/echoaudio/echoaudio_dsp.c
@@ -496,11 +496,7 @@ static int load_firmware(struct echoaudio *chip)
 	if (err < 0)
 		return err;
 
-	box_type = load_asic(chip);
-	if (box_type < 0)
-		return box_type;	/* error */
-
-	return box_type;
+	return load_asic(chip);
 }
 
 
diff --git a/sound/pci/echoaudio/layla24_dsp.c b/sound/pci/echoaudio/layla24_dsp.c
index e7b8f5fe7753..6ed485acd618 100644
--- a/sound/pci/echoaudio/layla24_dsp.c
+++ b/sound/pci/echoaudio/layla24_dsp.c
@@ -54,11 +54,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
 		return err;
 	chip->bad_board = false;
 
-	err = init_line_levels(chip);
-	if (err < 0)
-		return err;
-
-	return err;
+	return init_line_levels(chip);
 }
 
 
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 99c00e46ce23..fa9cbeb43f15 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1957,10 +1957,7 @@ static int snd_riptide_mixer(struct snd_riptide *chip)
 
 	chip->ac97_bus = pbus;
 	ac97.pci = chip->pci;
-	err = snd_ac97_mixer(pbus, &ac97, &chip->ac97);
-	if (err < 0)
-		return err;
-	return err;
+	return snd_ac97_mixer(pbus, &ac97, &chip->ac97);
 }
 
 #ifdef SUPPORT_JOYSTICK
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index 673eb8d8724d..b500d6d45e66 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -1383,15 +1383,13 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer)
 		return err;
 
 	/* initialize sampling rate to 48000 */
-	err = snd_usb_ctl_msg(mixer->chip->dev,
-		usb_sndctrlpipe(mixer->chip->dev, 0), UAC2_CS_CUR,
-		USB_RECIP_INTERFACE | USB_TYPE_CLASS |
-		USB_DIR_OUT, 0x0100, snd_usb_ctrl_intf(mixer->hostif) |
-		(0x29 << 8), sample_rate_buffer, 4);
-	if (err < 0)
-		return err;
-
-	return err;
+	return snd_usb_ctl_msg(mixer->chip->dev,
+			       usb_sndctrlpipe(mixer->chip->dev, 0),
+			       UAC2_CS_CUR,
+			       USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
+			       0x0100,
+			       snd_usb_ctrl_intf(mixer->hostif) | (0x29 << 8),
+			       sample_rate_buffer, 4);
 }
 
 /*
@@ -1446,11 +1444,7 @@ int snd_forte_controls_create(struct usb_mixer_interface *mixer)
 	}
 
 	/* val_len == 1 and UAC2_CS_MEM */
-	err = add_new_ctl(mixer, &usb_scarlett_ctl_sync, NULL, 0x3c, 0x00, 2,
-			  USB_MIXER_U8, 1, "Sample Clock Sync Status",
-			  &opt_sync, &elem);
-	if (err < 0)
-		return err;
-
-	return err;
+	return add_new_ctl(mixer, &usb_scarlett_ctl_sync, NULL, 0x3c, 0x00, 2,
+			   USB_MIXER_U8, 1, "Sample Clock Sync Status",
+			   &opt_sync, &elem);
 }
-- 
2.43.0


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

* [cocci] [PATCH 13/36] ALSA: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Jaroslav Kysela, Takashi Iwai
  Cc: cocci, linux-kernel, linux-sound

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>
---
 sound/pci/echoaudio/echoaudio_dsp.c |  6 +-----
 sound/pci/echoaudio/layla24_dsp.c   |  6 +-----
 sound/pci/riptide/riptide.c         |  5 +----
 sound/usb/mixer_scarlett.c          | 26 ++++++++++----------------
 4 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c
index 4dd494508c9b..90d7f364d2b3 100644
--- a/sound/pci/echoaudio/echoaudio_dsp.c
+++ b/sound/pci/echoaudio/echoaudio_dsp.c
@@ -496,11 +496,7 @@ static int load_firmware(struct echoaudio *chip)
 	if (err < 0)
 		return err;
 
-	box_type = load_asic(chip);
-	if (box_type < 0)
-		return box_type;	/* error */
-
-	return box_type;
+	return load_asic(chip);
 }
 
 
diff --git a/sound/pci/echoaudio/layla24_dsp.c b/sound/pci/echoaudio/layla24_dsp.c
index e7b8f5fe7753..6ed485acd618 100644
--- a/sound/pci/echoaudio/layla24_dsp.c
+++ b/sound/pci/echoaudio/layla24_dsp.c
@@ -54,11 +54,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
 		return err;
 	chip->bad_board = false;
 
-	err = init_line_levels(chip);
-	if (err < 0)
-		return err;
-
-	return err;
+	return init_line_levels(chip);
 }
 
 
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 99c00e46ce23..fa9cbeb43f15 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1957,10 +1957,7 @@ static int snd_riptide_mixer(struct snd_riptide *chip)
 
 	chip->ac97_bus = pbus;
 	ac97.pci = chip->pci;
-	err = snd_ac97_mixer(pbus, &ac97, &chip->ac97);
-	if (err < 0)
-		return err;
-	return err;
+	return snd_ac97_mixer(pbus, &ac97, &chip->ac97);
 }
 
 #ifdef SUPPORT_JOYSTICK
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index 673eb8d8724d..b500d6d45e66 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -1383,15 +1383,13 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer)
 		return err;
 
 	/* initialize sampling rate to 48000 */
-	err = snd_usb_ctl_msg(mixer->chip->dev,
-		usb_sndctrlpipe(mixer->chip->dev, 0), UAC2_CS_CUR,
-		USB_RECIP_INTERFACE | USB_TYPE_CLASS |
-		USB_DIR_OUT, 0x0100, snd_usb_ctrl_intf(mixer->hostif) |
-		(0x29 << 8), sample_rate_buffer, 4);
-	if (err < 0)
-		return err;
-
-	return err;
+	return snd_usb_ctl_msg(mixer->chip->dev,
+			       usb_sndctrlpipe(mixer->chip->dev, 0),
+			       UAC2_CS_CUR,
+			       USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
+			       0x0100,
+			       snd_usb_ctrl_intf(mixer->hostif) | (0x29 << 8),
+			       sample_rate_buffer, 4);
 }
 
 /*
@@ -1446,11 +1444,7 @@ int snd_forte_controls_create(struct usb_mixer_interface *mixer)
 	}
 
 	/* val_len == 1 and UAC2_CS_MEM */
-	err = add_new_ctl(mixer, &usb_scarlett_ctl_sync, NULL, 0x3c, 0x00, 2,
-			  USB_MIXER_U8, 1, "Sample Clock Sync Status",
-			  &opt_sync, &elem);
-	if (err < 0)
-		return err;
-
-	return err;
+	return add_new_ctl(mixer, &usb_scarlett_ctl_sync, NULL, 0x3c, 0x00, 2,
+			   USB_MIXER_U8, 1, "Sample Clock Sync Status",
+			   &opt_sync, &elem);
 }
-- 
2.43.0


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

* [PATCH 14/36] ASoC: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Vijendar Mukunda, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Cezary Rojewski, Peter Ujfalusi,
	Bard Liao, Kai Vehmanen, Sylwester Nawrocki, Daniel Baluta
  Cc: cocci, linux-kernel, linux-sound, Pierre-Louis Bossart,
	sound-open-firmware, Venkata Prasad Potturu

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>
---
 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 +-----
 4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index ef784cca13f2..01a0aaa60246 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -938,15 +938,10 @@ static int acp_max98388_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_dai *codec_dai =
 			snd_soc_card_get_codec_dai(card,
 						   MAX98388_CODEC_DAI);
-	int ret;
 
-	ret = snd_soc_dai_set_fmt(codec_dai,
-				  SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
-				  SND_SOC_DAIFMT_NB_NF);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return snd_soc_dai_set_fmt(codec_dai,
+				   SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
+				   SND_SOC_DAIFMT_NB_NF);
 }
 
 static const struct snd_soc_ops acp_max98388_ops = {
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index 9ee4d9926e06..a4c8cbfba096 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -236,12 +236,7 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
 
 	stream->stream_info.str_id = str_params.stream_id;
 
-	ret_val = stream->ops->open(sst->dev, &str_params);
-	if (ret_val <= 0)
-		return ret_val;
-
-
-	return ret_val;
+	return stream->ops->open(sst->dev, &str_params);
 }
 
 static void sst_period_elapsed(void *arg)
diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c
index 2474eb619882..515e4dfc1432 100644
--- a/sound/soc/samsung/smdk_spdif.c
+++ b/sound/soc/samsung/smdk_spdif.c
@@ -130,12 +130,8 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
 		return ret;
 
 	/* Set S/PDIF uses internal source clock */
-	ret = snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
-					rclk_rate, SND_SOC_CLOCK_IN);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
+				      rclk_rate, SND_SOC_CLOCK_IN);
 }
 
 static const struct snd_soc_ops smdk_spdif_ops = {
diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index e9f092f082a1..b9b2bdff4ccb 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -1114,11 +1114,7 @@ static int hda_dsp_s5_quirk(struct snd_sof_dev *sdev)
 	usleep_range(500, 1000);
 
 	/* Restore state for shutdown, back to reset */
-	ret = hda_dsp_ctrl_link_reset(sdev, true);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return hda_dsp_ctrl_link_reset(sdev, true);
 }
 
 int hda_dsp_shutdown_dma_flush(struct snd_sof_dev *sdev)
-- 
2.43.0


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

* [cocci] [PATCH 14/36] ASoC: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Vijendar Mukunda, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Cezary Rojewski, Peter Ujfalusi,
	Bard Liao, Kai Vehmanen, Sylwester Nawrocki, Daniel Baluta
  Cc: cocci, linux-kernel, linux-sound, Pierre-Louis Bossart,
	sound-open-firmware, Venkata Prasad Potturu

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>
---
 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 +-----
 4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index ef784cca13f2..01a0aaa60246 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -938,15 +938,10 @@ static int acp_max98388_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_dai *codec_dai =
 			snd_soc_card_get_codec_dai(card,
 						   MAX98388_CODEC_DAI);
-	int ret;
 
-	ret = snd_soc_dai_set_fmt(codec_dai,
-				  SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
-				  SND_SOC_DAIFMT_NB_NF);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return snd_soc_dai_set_fmt(codec_dai,
+				   SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
+				   SND_SOC_DAIFMT_NB_NF);
 }
 
 static const struct snd_soc_ops acp_max98388_ops = {
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index 9ee4d9926e06..a4c8cbfba096 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -236,12 +236,7 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
 
 	stream->stream_info.str_id = str_params.stream_id;
 
-	ret_val = stream->ops->open(sst->dev, &str_params);
-	if (ret_val <= 0)
-		return ret_val;
-
-
-	return ret_val;
+	return stream->ops->open(sst->dev, &str_params);
 }
 
 static void sst_period_elapsed(void *arg)
diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c
index 2474eb619882..515e4dfc1432 100644
--- a/sound/soc/samsung/smdk_spdif.c
+++ b/sound/soc/samsung/smdk_spdif.c
@@ -130,12 +130,8 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
 		return ret;
 
 	/* Set S/PDIF uses internal source clock */
-	ret = snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
-					rclk_rate, SND_SOC_CLOCK_IN);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
+				      rclk_rate, SND_SOC_CLOCK_IN);
 }
 
 static const struct snd_soc_ops smdk_spdif_ops = {
diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index e9f092f082a1..b9b2bdff4ccb 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -1114,11 +1114,7 @@ static int hda_dsp_s5_quirk(struct snd_sof_dev *sdev)
 	usleep_range(500, 1000);
 
 	/* Restore state for shutdown, back to reset */
-	ret = hda_dsp_ctrl_link_reset(sdev, true);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return hda_dsp_ctrl_link_reset(sdev, true);
 }
 
 int hda_dsp_shutdown_dma_flush(struct snd_sof_dev *sdev)
-- 
2.43.0


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

* [PATCH 15/36] iio: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Jonathan Cameron, Linus Walleij
  Cc: cocci, Andy Shevchenko, David Lechner, linux-iio, linux-kernel,
	Nuno Sá

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/iio/light/isl29028.c      |  6 +-----
 drivers/iio/light/tsl2583.c       | 14 +++-----------
 drivers/iio/magnetometer/ak8974.c |  6 +-----
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c
index b88e7c4eae3e..ea38d797082b 100644
--- a/drivers/iio/light/isl29028.c
+++ b/drivers/iio/light/isl29028.c
@@ -405,11 +405,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
 	if (ret < 0)
 		return ret;
 
-	ret = isl29028_set_pm_runtime_busy(chip, false);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return isl29028_set_pm_runtime_busy(chip, false);
 }
 
 static int isl29028_read_raw(struct iio_dev *indio_dev,
diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index a0dd122af2cf..a38a0130d854 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -456,12 +456,8 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
 
 	usleep_range(3000, 3500);
 
-	ret = tsl2583_set_power_state(chip, TSL2583_CNTL_PWR_ON |
-					    TSL2583_CNTL_ADC_ENBL);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return tsl2583_set_power_state(chip,
+				       TSL2583_CNTL_PWR_ON | TSL2583_CNTL_ADC_ENBL);
 }
 
 /* Sysfs Interface Functions */
@@ -790,11 +786,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
 		return ret;
 	}
 
-	ret = tsl2583_set_pm_runtime_busy(chip, false);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return tsl2583_set_pm_runtime_busy(chip, false);
 }
 
 static const struct iio_info tsl2583_info = {
diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index c7fdb7c2f543..c988d0e40cea 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -379,11 +379,7 @@ static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
 		return -ERANGE;
 	}
 
-	ret = regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
-	if (ret)
-		return ret;
-
-	return ret;
+	return regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
 }
 
 static irqreturn_t ak8974_drdy_irq(int irq, void *d)
-- 
2.43.0


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

* [cocci] [PATCH 15/36] iio: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Jonathan Cameron, Linus Walleij
  Cc: cocci, Andy Shevchenko, David Lechner, linux-iio, linux-kernel,
	Nuno Sá

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/iio/light/isl29028.c      |  6 +-----
 drivers/iio/light/tsl2583.c       | 14 +++-----------
 drivers/iio/magnetometer/ak8974.c |  6 +-----
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c
index b88e7c4eae3e..ea38d797082b 100644
--- a/drivers/iio/light/isl29028.c
+++ b/drivers/iio/light/isl29028.c
@@ -405,11 +405,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
 	if (ret < 0)
 		return ret;
 
-	ret = isl29028_set_pm_runtime_busy(chip, false);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return isl29028_set_pm_runtime_busy(chip, false);
 }
 
 static int isl29028_read_raw(struct iio_dev *indio_dev,
diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index a0dd122af2cf..a38a0130d854 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -456,12 +456,8 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
 
 	usleep_range(3000, 3500);
 
-	ret = tsl2583_set_power_state(chip, TSL2583_CNTL_PWR_ON |
-					    TSL2583_CNTL_ADC_ENBL);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return tsl2583_set_power_state(chip,
+				       TSL2583_CNTL_PWR_ON | TSL2583_CNTL_ADC_ENBL);
 }
 
 /* Sysfs Interface Functions */
@@ -790,11 +786,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
 		return ret;
 	}
 
-	ret = tsl2583_set_pm_runtime_busy(chip, false);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return tsl2583_set_pm_runtime_busy(chip, false);
 }
 
 static const struct iio_info tsl2583_info = {
diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index c7fdb7c2f543..c988d0e40cea 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -379,11 +379,7 @@ static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
 		return -ERANGE;
 	}
 
-	ret = regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
-	if (ret)
-		return ret;
-
-	return ret;
+	return regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
 }
 
 static irqreturn_t ak8974_drdy_irq(int irq, void *d)
-- 
2.43.0


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

* [PATCH 16/36] Input: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Dmitry Torokhov; +Cc: cocci, linux-input, linux-kernel

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/input/keyboard/pmic8xxx-keypad.c | 8 +-------
 drivers/input/mouse/synaptics_i2c.c      | 6 +-----
 drivers/input/rmi4/rmi_smbus.c           | 7 +------
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index 35d1aa2a22a5..c916e80e2f58 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -462,15 +462,9 @@ static int pmic8xxx_kp_enable(struct pmic8xxx_kp *kp)
 
 static int pmic8xxx_kp_disable(struct pmic8xxx_kp *kp)
 {
-	int rc;
-
 	kp->ctrl_reg &= ~KEYP_CTRL_KEYP_EN;
 
-	rc = regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
-	if (rc < 0)
-		return rc;
-
-	return rc;
+	return regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
 }
 
 static int pmic8xxx_kp_open(struct input_dev *dev)
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index d4cf982f1263..85e37e2ce45b 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -257,11 +257,7 @@ static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val)
 	if (error)
 		return error;
 
-	error = i2c_smbus_write_byte_data(client, reg & 0xff, val);
-	if (error)
-		return error;
-
-	return error;
+	return i2c_smbus_write_byte_data(client, reg & 0xff, val);
 }
 
 static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg)
diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c
index 6de68c602558..3160714a514a 100644
--- a/drivers/input/rmi4/rmi_smbus.c
+++ b/drivers/input/rmi4/rmi_smbus.c
@@ -177,13 +177,8 @@ static int smb_block_read(struct rmi_transport_dev *xport,
 	struct rmi_smb_xport *rmi_smb =
 		container_of(xport, struct rmi_smb_xport, xport);
 	struct i2c_client *client = rmi_smb->client;
-	int retval;
 
-	retval = i2c_smbus_read_block_data(client, commandcode, buf);
-	if (retval < 0)
-		return retval;
-
-	return retval;
+	return i2c_smbus_read_block_data(client, commandcode, buf);
 }
 
 static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr,
-- 
2.43.0


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

* [cocci] [PATCH 16/36] Input: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Dmitry Torokhov; +Cc: cocci, linux-input, linux-kernel

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/input/keyboard/pmic8xxx-keypad.c | 8 +-------
 drivers/input/mouse/synaptics_i2c.c      | 6 +-----
 drivers/input/rmi4/rmi_smbus.c           | 7 +------
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index 35d1aa2a22a5..c916e80e2f58 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -462,15 +462,9 @@ static int pmic8xxx_kp_enable(struct pmic8xxx_kp *kp)
 
 static int pmic8xxx_kp_disable(struct pmic8xxx_kp *kp)
 {
-	int rc;
-
 	kp->ctrl_reg &= ~KEYP_CTRL_KEYP_EN;
 
-	rc = regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
-	if (rc < 0)
-		return rc;
-
-	return rc;
+	return regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
 }
 
 static int pmic8xxx_kp_open(struct input_dev *dev)
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index d4cf982f1263..85e37e2ce45b 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -257,11 +257,7 @@ static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val)
 	if (error)
 		return error;
 
-	error = i2c_smbus_write_byte_data(client, reg & 0xff, val);
-	if (error)
-		return error;
-
-	return error;
+	return i2c_smbus_write_byte_data(client, reg & 0xff, val);
 }
 
 static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg)
diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c
index 6de68c602558..3160714a514a 100644
--- a/drivers/input/rmi4/rmi_smbus.c
+++ b/drivers/input/rmi4/rmi_smbus.c
@@ -177,13 +177,8 @@ static int smb_block_read(struct rmi_transport_dev *xport,
 	struct rmi_smb_xport *rmi_smb =
 		container_of(xport, struct rmi_smb_xport, xport);
 	struct i2c_client *client = rmi_smb->client;
-	int retval;
 
-	retval = i2c_smbus_read_block_data(client, commandcode, buf);
-	if (retval < 0)
-		return retval;
-
-	return retval;
+	return i2c_smbus_read_block_data(client, commandcode, buf);
 }
 
 static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr,
-- 
2.43.0


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

* [PATCH 17/36] clk: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Michael Turquette, Stephen Boyd
  Cc: cocci, Brian Masney, linux-clk, linux-kernel

Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.

In the lmk04832 driver, the hardware sequence comments are moved
above the final return by hand.

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/clk/clk-cs2000-cp.c |  6 +-----
 drivers/clk/clk-lmk04832.c  | 12 ++++--------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index 8800472ba63f..4de581771d7d 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -404,11 +404,7 @@ static int cs2000_enable(struct clk_hw *hw)
 	if (ret < 0)
 		return ret;
 
-	ret = cs2000_wait_pll_lock(priv);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return cs2000_wait_pll_lock(priv);
 }
 
 static void cs2000_disable(struct clk_hw *hw)
diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
index 9bf86caad829..f006401c1586 100644
--- a/drivers/clk/clk-lmk04832.c
+++ b/drivers/clk/clk-lmk04832.c
@@ -822,13 +822,6 @@ static int lmk04832_sclk_sync_sequence(struct lmk04832 *lmk)
 	if (ret)
 		return ret;
 
-	ret = regmap_update_bits(lmk->regmap, LMK04832_REG_SYNC,
-				 LMK04832_BIT_SYNC_MODE,
-				 FIELD_PREP(LMK04832_BIT_SYNC_MODE,
-					    lmk->sync_mode));
-	if (ret)
-		return ret;
-
 	/*
 	 * 9. (optional) if SCLKx_y_DIS_MODE was used to mute SYSREF outputs
 	 *    during the SYNC event, restore SCLKx_y_DIS_MODE=0 for active state,
@@ -843,7 +836,10 @@ static int lmk04832_sclk_sync_sequence(struct lmk04832 *lmk)
 	 *     SYNC pulse to delay the output by some number of VCO counts).
 	 */
 
-	return ret;
+	return regmap_update_bits(lmk->regmap, LMK04832_REG_SYNC,
+				  LMK04832_BIT_SYNC_MODE,
+				  FIELD_PREP(LMK04832_BIT_SYNC_MODE,
+					     lmk->sync_mode));
 }
 
 static int lmk04832_sclk_is_enabled(struct clk_hw *hw)
-- 
2.43.0


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

* [cocci] [PATCH 17/36] clk: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Michael Turquette, Stephen Boyd
  Cc: cocci, Brian Masney, linux-clk, linux-kernel

Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.

In the lmk04832 driver, the hardware sequence comments are moved
above the final return by hand.

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/clk/clk-cs2000-cp.c |  6 +-----
 drivers/clk/clk-lmk04832.c  | 12 ++++--------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index 8800472ba63f..4de581771d7d 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -404,11 +404,7 @@ static int cs2000_enable(struct clk_hw *hw)
 	if (ret < 0)
 		return ret;
 
-	ret = cs2000_wait_pll_lock(priv);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return cs2000_wait_pll_lock(priv);
 }
 
 static void cs2000_disable(struct clk_hw *hw)
diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
index 9bf86caad829..f006401c1586 100644
--- a/drivers/clk/clk-lmk04832.c
+++ b/drivers/clk/clk-lmk04832.c
@@ -822,13 +822,6 @@ static int lmk04832_sclk_sync_sequence(struct lmk04832 *lmk)
 	if (ret)
 		return ret;
 
-	ret = regmap_update_bits(lmk->regmap, LMK04832_REG_SYNC,
-				 LMK04832_BIT_SYNC_MODE,
-				 FIELD_PREP(LMK04832_BIT_SYNC_MODE,
-					    lmk->sync_mode));
-	if (ret)
-		return ret;
-
 	/*
 	 * 9. (optional) if SCLKx_y_DIS_MODE was used to mute SYSREF outputs
 	 *    during the SYNC event, restore SCLKx_y_DIS_MODE=0 for active state,
@@ -843,7 +836,10 @@ static int lmk04832_sclk_sync_sequence(struct lmk04832 *lmk)
 	 *     SYNC pulse to delay the output by some number of VCO counts).
 	 */
 
-	return ret;
+	return regmap_update_bits(lmk->regmap, LMK04832_REG_SYNC,
+				  LMK04832_BIT_SYNC_MODE,
+				  FIELD_PREP(LMK04832_BIT_SYNC_MODE,
+					     lmk->sync_mode));
 }
 
 static int lmk04832_sclk_is_enabled(struct clk_hw *hw)
-- 
2.43.0


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

* [PATCH 18/36] crypto: drivers - remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Giovanni Cabiddu, Herbert Xu, David S. Miller,
	Srujana Challa, Bharat Bhushan
  Cc: cocci, linux-crypto, linux-kernel, qat-linux

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/crypto/intel/qat/qat_common/adf_gen2_config.c   | 8 ++------
 drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c | 7 +------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c b/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c
index c27ff6d18e11..57025bffee73 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c
@@ -155,12 +155,8 @@ static int adf_gen2_comp_dev_config(struct adf_accel_dev *accel_dev)
 	}
 
 	val = i;
-	ret = adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_DC,
-					  &val, ADF_DEC);
-	if (ret)
-		return ret;
-
-	return ret;
+	return adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
+					   ADF_NUM_DC, &val, ADF_DEC);
 
 err:
 	dev_err(&GET_DEV(accel_dev), "Failed to add configuration for compression\n");
diff --git a/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c b/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
index 95f3de3a34eb..1542a110ba37 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
@@ -235,7 +235,6 @@ int otx2_cpt_lf_reset_msg(struct otx2_cptlfs_info *lfs, int slot)
 	struct otx2_mbox *mbox = lfs->mbox;
 	struct pci_dev *pdev = lfs->pdev;
 	struct cpt_lf_rst_req *req;
-	int ret;
 
 	req = (struct cpt_lf_rst_req *)otx2_mbox_alloc_msg_rsp(mbox, 0, sizeof(*req),
 							       sizeof(struct msg_rsp));
@@ -248,11 +247,7 @@ int otx2_cpt_lf_reset_msg(struct otx2_cptlfs_info *lfs, int slot)
 	req->hdr.sig = OTX2_MBOX_REQ_SIG;
 	req->hdr.pcifunc = 0;
 	req->slot = slot;
-	ret = otx2_cpt_send_mbox_msg(mbox, pdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return otx2_cpt_send_mbox_msg(mbox, pdev);
 }
 EXPORT_SYMBOL_NS_GPL(otx2_cpt_lf_reset_msg, "CRYPTO_DEV_OCTEONTX2_CPT");
 
-- 
2.43.0


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

* [cocci] [PATCH 18/36] crypto: drivers - remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Giovanni Cabiddu, Herbert Xu, David S. Miller,
	Srujana Challa, Bharat Bhushan
  Cc: cocci, linux-crypto, linux-kernel, qat-linux

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/crypto/intel/qat/qat_common/adf_gen2_config.c   | 8 ++------
 drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c | 7 +------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c b/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c
index c27ff6d18e11..57025bffee73 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_gen2_config.c
@@ -155,12 +155,8 @@ static int adf_gen2_comp_dev_config(struct adf_accel_dev *accel_dev)
 	}
 
 	val = i;
-	ret = adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC, ADF_NUM_DC,
-					  &val, ADF_DEC);
-	if (ret)
-		return ret;
-
-	return ret;
+	return adf_cfg_add_key_value_param(accel_dev, ADF_KERNEL_SEC,
+					   ADF_NUM_DC, &val, ADF_DEC);
 
 err:
 	dev_err(&GET_DEV(accel_dev), "Failed to add configuration for compression\n");
diff --git a/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c b/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
index 95f3de3a34eb..1542a110ba37 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
@@ -235,7 +235,6 @@ int otx2_cpt_lf_reset_msg(struct otx2_cptlfs_info *lfs, int slot)
 	struct otx2_mbox *mbox = lfs->mbox;
 	struct pci_dev *pdev = lfs->pdev;
 	struct cpt_lf_rst_req *req;
-	int ret;
 
 	req = (struct cpt_lf_rst_req *)otx2_mbox_alloc_msg_rsp(mbox, 0, sizeof(*req),
 							       sizeof(struct msg_rsp));
@@ -248,11 +247,7 @@ int otx2_cpt_lf_reset_msg(struct otx2_cptlfs_info *lfs, int slot)
 	req->hdr.sig = OTX2_MBOX_REQ_SIG;
 	req->hdr.pcifunc = 0;
 	req->slot = slot;
-	ret = otx2_cpt_send_mbox_msg(mbox, pdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return otx2_cpt_send_mbox_msg(mbox, pdev);
 }
 EXPORT_SYMBOL_NS_GPL(otx2_cpt_lf_reset_msg, "CRYPTO_DEV_OCTEONTX2_CPT");
 
-- 
2.43.0


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

* [PATCH 19/36] dmaengine: qcom_hidma: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sinan Kaya, Vinod Koul
  Cc: cocci, dmaengine, Frank Li, linux-arm-kernel, linux-arm-msm,
	linux-kernel

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/dma/qcom/hidma_ll.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c
index 53244e0e34a3..f081aa787f0c 100644
--- a/drivers/dma/qcom/hidma_ll.c
+++ b/drivers/dma/qcom/hidma_ll.c
@@ -677,11 +677,7 @@ int hidma_ll_setup(struct hidma_lldev *lldev)
 	/* configure interrupts */
 	hidma_ll_setup_irq(lldev, lldev->msi_support);
 
-	rc = hidma_ll_enable(lldev);
-	if (rc)
-		return rc;
-
-	return rc;
+	return hidma_ll_enable(lldev);
 }
 
 void hidma_ll_setup_irq(struct hidma_lldev *lldev, bool msi)
-- 
2.43.0


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

* [cocci] [PATCH 19/36] dmaengine: qcom_hidma: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sinan Kaya, Vinod Koul
  Cc: cocci, dmaengine, Frank Li, linux-arm-kernel, linux-arm-msm,
	linux-kernel

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/dma/qcom/hidma_ll.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c
index 53244e0e34a3..f081aa787f0c 100644
--- a/drivers/dma/qcom/hidma_ll.c
+++ b/drivers/dma/qcom/hidma_ll.c
@@ -677,11 +677,7 @@ int hidma_ll_setup(struct hidma_lldev *lldev)
 	/* configure interrupts */
 	hidma_ll_setup_irq(lldev, lldev->msi_support);
 
-	rc = hidma_ll_enable(lldev);
-	if (rc)
-		return rc;
-
-	return rc;
+	return hidma_ll_enable(lldev);
 }
 
 void hidma_ll_setup_irq(struct hidma_lldev *lldev, bool msi)
-- 
2.43.0


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

* [PATCH 20/36] stm class: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alexander Shishkin, Maxime Coquelin,
	Alexandre Torgue
  Cc: cocci, linux-arm-kernel, linux-kernel, linux-stm32

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/hwtracing/stm/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index f48c6a8a0654..edf3d69a84a9 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -602,17 +602,11 @@ static ssize_t notrace
 stm_write(struct stm_device *stm, struct stm_output *output,
 	  unsigned int chan, const char *buf, size_t count, struct stm_source_data *source)
 {
-	int err;
-
 	/* stm->pdrv is serialized against policy_mutex */
 	if (!stm->pdrv)
 		return -ENODEV;
 
-	err = stm->pdrv->write(stm->data, output, chan, buf, count, source);
-	if (err < 0)
-		return err;
-
-	return err;
+	return stm->pdrv->write(stm->data, output, chan, buf, count, source);
 }
 
 static ssize_t stm_char_write(struct file *file, const char __user *buf,
-- 
2.43.0


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

* [cocci] [PATCH 20/36] stm class: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alexander Shishkin, Maxime Coquelin,
	Alexandre Torgue
  Cc: cocci, linux-arm-kernel, linux-kernel, linux-stm32

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/hwtracing/stm/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index f48c6a8a0654..edf3d69a84a9 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -602,17 +602,11 @@ static ssize_t notrace
 stm_write(struct stm_device *stm, struct stm_output *output,
 	  unsigned int chan, const char *buf, size_t count, struct stm_source_data *source)
 {
-	int err;
-
 	/* stm->pdrv is serialized against policy_mutex */
 	if (!stm->pdrv)
 		return -ENODEV;
 
-	err = stm->pdrv->write(stm->data, output, chan, buf, count, source);
-	if (err < 0)
-		return err;
-
-	return err;
+	return stm->pdrv->write(stm->data, output, chan, buf, count, source);
 }
 
 static ssize_t stm_char_write(struct file *file, const char __user *buf,
-- 
2.43.0


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

* [PATCH 21/36] RDMA/ocrdma: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Selvin Xavier, Jason Gunthorpe, Leon Romanovsky
  Cc: cocci, linux-kernel, linux-rdma

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/infiniband/hw/ocrdma/ocrdma_verbs.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index cfe3d19b73b3..017b3660173e 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1749,11 +1749,8 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_dev *dev, struct ocrdma_srq *srq,
 	status = ib_respond_udata(udata, uresp);
 	if (status)
 		return status;
-	status = ocrdma_add_mmap(srq->pd->uctx, uresp.rq_page_addr[0],
-				 uresp.rq_page_size);
-	if (status)
-		return status;
-	return status;
+	return ocrdma_add_mmap(srq->pd->uctx, uresp.rq_page_addr[0],
+			       uresp.rq_page_size);
 }
 
 int ocrdma_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr,
-- 
2.43.0


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

* [cocci] [PATCH 21/36] RDMA/ocrdma: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Selvin Xavier, Jason Gunthorpe, Leon Romanovsky
  Cc: cocci, linux-kernel, linux-rdma

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/infiniband/hw/ocrdma/ocrdma_verbs.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index cfe3d19b73b3..017b3660173e 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1749,11 +1749,8 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_dev *dev, struct ocrdma_srq *srq,
 	status = ib_respond_udata(udata, uresp);
 	if (status)
 		return status;
-	status = ocrdma_add_mmap(srq->pd->uctx, uresp.rq_page_addr[0],
-				 uresp.rq_page_size);
-	if (status)
-		return status;
-	return status;
+	return ocrdma_add_mmap(srq->pd->uctx, uresp.rq_page_addr[0],
+			       uresp.rq_page_size);
 }
 
 int ocrdma_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr,
-- 
2.43.0


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

* [PATCH 22/36] iommu/s390: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Niklas Schnelle, Matthew Rosato, Joerg Roedel (AMD),
	Will Deacon
  Cc: cocci, Gerald Schaefer, iommu, linux-kernel, linux-s390,
	Robin Murphy

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/iommu/s390-iommu.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index f148f559ac56..d008b1d14a9e 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -1115,8 +1115,6 @@ __setup("s390_iommu_aperture=", s390_iommu_aperture_setup);
 
 static int __init s390_iommu_init(void)
 {
-	int rc;
-
 	iommu_dma_forcedac = true;
 	s390_iommu_aperture = (u64)virt_to_phys(high_memory);
 	if (!s390_iommu_aperture_factor)
@@ -1124,11 +1122,7 @@ static int __init s390_iommu_init(void)
 	else
 		s390_iommu_aperture *= s390_iommu_aperture_factor;
 
-	rc = dma_alloc_cpu_table_caches();
-	if (rc)
-		return rc;
-
-	return rc;
+	return dma_alloc_cpu_table_caches();
 }
 subsys_initcall(s390_iommu_init);
 
-- 
2.43.0


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

* [cocci] [PATCH 22/36] iommu/s390: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Niklas Schnelle, Matthew Rosato, Joerg Roedel (AMD),
	Will Deacon
  Cc: cocci, Gerald Schaefer, iommu, linux-kernel, linux-s390,
	Robin Murphy

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/iommu/s390-iommu.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index f148f559ac56..d008b1d14a9e 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -1115,8 +1115,6 @@ __setup("s390_iommu_aperture=", s390_iommu_aperture_setup);
 
 static int __init s390_iommu_init(void)
 {
-	int rc;
-
 	iommu_dma_forcedac = true;
 	s390_iommu_aperture = (u64)virt_to_phys(high_memory);
 	if (!s390_iommu_aperture_factor)
@@ -1124,11 +1122,7 @@ static int __init s390_iommu_init(void)
 	else
 		s390_iommu_aperture *= s390_iommu_aperture_factor;
 
-	rc = dma_alloc_cpu_table_caches();
-	if (rc)
-		return rc;
-
-	return rc;
+	return dma_alloc_cpu_table_caches();
 }
 subsys_initcall(s390_iommu_init);
 
-- 
2.43.0


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

* [PATCH 23/36] dm vdo: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Matthew Sakai; +Cc: cocci, dm-devel, linux-kernel

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/md/dm-vdo/encodings.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-vdo/encodings.c b/drivers/md/dm-vdo/encodings.c
index d75e023df637..b09373b0cfe8 100644
--- a/drivers/md/dm-vdo/encodings.c
+++ b/drivers/md/dm-vdo/encodings.c
@@ -1333,12 +1333,8 @@ int vdo_validate_config(const struct vdo_config *config,
 	if (result != VDO_SUCCESS)
 		return result;
 
-	result = VDO_ASSERT(is_power_of_2(config->recovery_journal_size),
-			    "recovery journal size must be a power of two");
-	if (result != VDO_SUCCESS)
-		return result;
-
-	return result;
+	return VDO_ASSERT(is_power_of_2(config->recovery_journal_size),
+			  "recovery journal size must be a power of two");
 }
 
 /**
-- 
2.43.0


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

* [cocci] [PATCH 23/36] dm vdo: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Matthew Sakai; +Cc: cocci, dm-devel, linux-kernel

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/md/dm-vdo/encodings.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-vdo/encodings.c b/drivers/md/dm-vdo/encodings.c
index d75e023df637..b09373b0cfe8 100644
--- a/drivers/md/dm-vdo/encodings.c
+++ b/drivers/md/dm-vdo/encodings.c
@@ -1333,12 +1333,8 @@ int vdo_validate_config(const struct vdo_config *config,
 	if (result != VDO_SUCCESS)
 		return result;
 
-	result = VDO_ASSERT(is_power_of_2(config->recovery_journal_size),
-			    "recovery journal size must be a power of two");
-	if (result != VDO_SUCCESS)
-		return result;
-
-	return result;
+	return VDO_ASSERT(is_power_of_2(config->recovery_journal_size),
+			  "recovery journal size must be a power of two");
 }
 
 /**
-- 
2.43.0


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

* [PATCH 24/36] pinctrl: mediatek: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sean Wang, Linus Walleij, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: cocci, linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek

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/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index 4918d38abfc2..a8ab982d8f21 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -1242,11 +1242,7 @@ int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw,
 	if (err)
 		return err;
 
-	err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV_E1, e1);
-	if (err)
-		return err;
-
-	return err;
+	return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV_E1, e1);
 }
 EXPORT_SYMBOL_GPL(mtk_pinconf_adv_drive_set);
 
-- 
2.43.0


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

* [cocci] [PATCH 24/36] pinctrl: mediatek: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sean Wang, Linus Walleij, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: cocci, linux-arm-kernel, linux-gpio, linux-kernel, linux-mediatek

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/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index 4918d38abfc2..a8ab982d8f21 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -1242,11 +1242,7 @@ int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw,
 	if (err)
 		return err;
 
-	err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV_E1, e1);
-	if (err)
-		return err;
-
-	return err;
+	return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV_E1, e1);
 }
 EXPORT_SYMBOL_GPL(mtk_pinconf_adv_drive_set);
 
-- 
2.43.0


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

* [PATCH 25/36] platform/x86: toshiba_haps: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Azael Avalos, Hans de Goede, Ilpo Järvinen
  Cc: cocci, linux-kernel, platform-driver-x86

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/platform/x86/toshiba_haps.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/platform/x86/toshiba_haps.c b/drivers/platform/x86/toshiba_haps.c
index c6633b74029f..4f62476b8dd1 100644
--- a/drivers/platform/x86/toshiba_haps.c
+++ b/drivers/platform/x86/toshiba_haps.c
@@ -251,11 +251,7 @@ static int toshiba_haps_resume(struct device *device)
 					    haps->protection_level);
 
 	/* Reset the protection on resume */
-	ret = toshiba_haps_reset_protection(haps->acpi_dev->handle);
-	if (ret != 0)
-		return ret;
-
-	return ret;
+	return toshiba_haps_reset_protection(haps->acpi_dev->handle);
 }
 #endif
 
-- 
2.43.0


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

* [cocci] [PATCH 25/36] platform/x86: toshiba_haps: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Azael Avalos, Hans de Goede, Ilpo Järvinen
  Cc: cocci, linux-kernel, platform-driver-x86

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/platform/x86/toshiba_haps.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/platform/x86/toshiba_haps.c b/drivers/platform/x86/toshiba_haps.c
index c6633b74029f..4f62476b8dd1 100644
--- a/drivers/platform/x86/toshiba_haps.c
+++ b/drivers/platform/x86/toshiba_haps.c
@@ -251,11 +251,7 @@ static int toshiba_haps_resume(struct device *device)
 					    haps->protection_level);
 
 	/* Reset the protection on resume */
-	ret = toshiba_haps_reset_protection(haps->acpi_dev->handle);
-	if (ret != 0)
-		return ret;
-
-	return ret;
+	return toshiba_haps_reset_protection(haps->acpi_dev->handle);
 }
 #endif
 
-- 
2.43.0


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

* [PATCH 26/36] power: supply: pm8916_lbc: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sebastian Reichel; +Cc: cocci, linux-kernel, linux-pm

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/power/supply/pm8916_lbc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/pm8916_lbc.c b/drivers/power/supply/pm8916_lbc.c
index cdc4d78c4219..569f3f4b16fe 100644
--- a/drivers/power/supply/pm8916_lbc.c
+++ b/drivers/power/supply/pm8916_lbc.c
@@ -231,11 +231,9 @@ static int pm8916_lbc_charger_probe_dt(struct pm8916_lbc_charger *chg)
 		return ret;
 
 	/* Disable charger timeout. */
-	ret = regmap_write(chg->regmap, chg->reg[LBC_CHGR] + PM8916_LBC_CHGR_TCHG_MAX_EN, 0x00);
-	if (ret)
-		return ret;
-
-	return ret;
+	return regmap_write(chg->regmap,
+			    chg->reg[LBC_CHGR] + PM8916_LBC_CHGR_TCHG_MAX_EN,
+			    0x00);
 }
 
 static const struct power_supply_desc pm8916_lbc_charger_psy_desc = {
-- 
2.43.0


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

* [cocci] [PATCH 26/36] power: supply: pm8916_lbc: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sebastian Reichel; +Cc: cocci, linux-kernel, linux-pm

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/power/supply/pm8916_lbc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/pm8916_lbc.c b/drivers/power/supply/pm8916_lbc.c
index cdc4d78c4219..569f3f4b16fe 100644
--- a/drivers/power/supply/pm8916_lbc.c
+++ b/drivers/power/supply/pm8916_lbc.c
@@ -231,11 +231,9 @@ static int pm8916_lbc_charger_probe_dt(struct pm8916_lbc_charger *chg)
 		return ret;
 
 	/* Disable charger timeout. */
-	ret = regmap_write(chg->regmap, chg->reg[LBC_CHGR] + PM8916_LBC_CHGR_TCHG_MAX_EN, 0x00);
-	if (ret)
-		return ret;
-
-	return ret;
+	return regmap_write(chg->regmap,
+			    chg->reg[LBC_CHGR] + PM8916_LBC_CHGR_TCHG_MAX_EN,
+			    0x00);
 }
 
 static const struct power_supply_desc pm8916_lbc_charger_psy_desc = {
-- 
2.43.0


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

* [PATCH 27/36] RAS/AMD/ATL: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Yazen Ghannam, Tony Luck, Borislav Petkov
  Cc: cocci, linux-edac, linux-kernel

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/ras/amd/atl/map.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/ras/amd/atl/map.c b/drivers/ras/amd/atl/map.c
index 24a05af747d5..4ec9333ef745 100644
--- a/drivers/ras/amd/atl/map.c
+++ b/drivers/ras/amd/atl/map.c
@@ -771,9 +771,5 @@ int get_address_map(struct addr_ctx *ctx)
 
 	dump_address_map(&ctx->map);
 
-	ret = validate_address_map(ctx);
-	if (ret)
-		return ret;
-
-	return ret;
+	return validate_address_map(ctx);
 }
-- 
2.43.0


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

* [cocci] [PATCH 27/36] RAS/AMD/ATL: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Yazen Ghannam, Tony Luck, Borislav Petkov
  Cc: cocci, linux-edac, linux-kernel

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/ras/amd/atl/map.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/ras/amd/atl/map.c b/drivers/ras/amd/atl/map.c
index 24a05af747d5..4ec9333ef745 100644
--- a/drivers/ras/amd/atl/map.c
+++ b/drivers/ras/amd/atl/map.c
@@ -771,9 +771,5 @@ int get_address_map(struct addr_ctx *ctx)
 
 	dump_address_map(&ctx->map);
 
-	ret = validate_address_map(ctx);
-	if (ret)
-		return ret;
-
-	return ret;
+	return validate_address_map(ctx);
 }
-- 
2.43.0


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

* [PATCH 28/36] regulator: wm831x-isink: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Liam Girdwood, Mark Brown; +Cc: cocci, linux-kernel, patches

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/regulator/wm831x-isink.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 43f220cea21c..b46e2cde5e9d 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -62,11 +62,7 @@ static int wm831x_isink_disable(struct regulator_dev *rdev)
 	if (ret < 0)
 		return ret;
 
-	ret = wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_ENA, 0);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_ENA, 0);
 
 }
 
-- 
2.43.0


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

* [cocci] [PATCH 28/36] regulator: wm831x-isink: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Liam Girdwood, Mark Brown; +Cc: cocci, linux-kernel, patches

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/regulator/wm831x-isink.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 43f220cea21c..b46e2cde5e9d 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -62,11 +62,7 @@ static int wm831x_isink_disable(struct regulator_dev *rdev)
 	if (ret < 0)
 		return ret;
 
-	ret = wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_ENA, 0);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_ENA, 0);
 
 }
 
-- 
2.43.0


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

* [PATCH 29/36] rtc: pcf2127: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alexandre Belloni; +Cc: cocci, linux-kernel, linux-rtc

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/rtc/rtc-pcf2127.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 1995e9f2756d..ff2023908f5a 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -1184,12 +1184,7 @@ static int pcf2127_configure_interrupt_pins(struct device *dev)
 	if (ret)
 		return ret;
 
-	ret = regmap_write(pcf2127->regmap,
-			   PCF2131_REG_INT_A_MASK2, 0);
-	if (ret)
-		return ret;
-
-	return ret;
+	return regmap_write(pcf2127->regmap, PCF2131_REG_INT_A_MASK2, 0);
 }
 
 static int pcf2127_probe(struct device *dev, struct regmap *regmap,
-- 
2.43.0


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

* [cocci] [PATCH 29/36] rtc: pcf2127: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Alexandre Belloni; +Cc: cocci, linux-kernel, linux-rtc

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/rtc/rtc-pcf2127.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 1995e9f2756d..ff2023908f5a 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -1184,12 +1184,7 @@ static int pcf2127_configure_interrupt_pins(struct device *dev)
 	if (ret)
 		return ret;
 
-	ret = regmap_write(pcf2127->regmap,
-			   PCF2131_REG_INT_A_MASK2, 0);
-	if (ret)
-		return ret;
-
-	return ret;
+	return regmap_write(pcf2127->regmap, PCF2131_REG_INT_A_MASK2, 0);
 }
 
 static int pcf2127_probe(struct device *dev, struct regmap *regmap,
-- 
2.43.0


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

* [PATCH 30/36] scsi: mpt3sas: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sathya Prakash, Sreekanth Reddy,
	Suganath Prabu Subramani, Ranjan Kumar, James E.J. Bottomley,
	Martin K. Petersen
  Cc: cocci, linux-kernel, linux-scsi, MPT-FusionLinux.pdl

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/scsi/mpt3sas/mpt3sas_base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 79052f2accbd..791a3c5fbf44 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -8369,11 +8369,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
 		return r; /* scan_start and scan_finished support */
 	}
 
-	r = _base_send_port_enable(ioc);
-	if (r)
-		return r;
-
-	return r;
+	return _base_send_port_enable(ioc);
 }
 
 /**
-- 
2.43.0


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

* [cocci] [PATCH 30/36] scsi: mpt3sas: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Sathya Prakash, Sreekanth Reddy,
	Suganath Prabu Subramani, Ranjan Kumar, James E.J. Bottomley,
	Martin K. Petersen
  Cc: cocci, linux-kernel, linux-scsi, MPT-FusionLinux.pdl

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/scsi/mpt3sas/mpt3sas_base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 79052f2accbd..791a3c5fbf44 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -8369,11 +8369,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc)
 		return r; /* scan_start and scan_finished support */
 	}
 
-	r = _base_send_port_enable(ioc);
-	if (r)
-		return r;
-
-	return r;
+	return _base_send_port_enable(ioc);
 }
 
 /**
-- 
2.43.0


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

* [PATCH 31/36] thermal/drivers/k3_bandgap: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Rafael J. Wysocki, Daniel Lezcano
  Cc: cocci, linux-kernel, linux-pm, Lukasz Luba, Zhang Rui

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/thermal/k3_bandgap.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c
index 678d6ed711b5..766fab7bcf1b 100644
--- a/drivers/thermal/k3_bandgap.c
+++ b/drivers/thermal/k3_bandgap.c
@@ -141,13 +141,8 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
 static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
 {
 	struct k3_thermal_data *data = thermal_zone_device_priv(tz);
-	int ret = 0;
 
-	ret = k3_bgp_read_temp(data, temp);
-	if (ret)
-		return ret;
-
-	return ret;
+	return k3_bgp_read_temp(data, temp);
 }
 
 static const struct thermal_zone_device_ops k3_of_thermal_ops = {
-- 
2.43.0


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

* [cocci] [PATCH 31/36] thermal/drivers/k3_bandgap: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Rafael J. Wysocki, Daniel Lezcano
  Cc: cocci, linux-kernel, linux-pm, Lukasz Luba, Zhang Rui

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/thermal/k3_bandgap.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c
index 678d6ed711b5..766fab7bcf1b 100644
--- a/drivers/thermal/k3_bandgap.c
+++ b/drivers/thermal/k3_bandgap.c
@@ -141,13 +141,8 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
 static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
 {
 	struct k3_thermal_data *data = thermal_zone_device_priv(tz);
-	int ret = 0;
 
-	ret = k3_bgp_read_temp(data, temp);
-	if (ret)
-		return ret;
-
-	return ret;
+	return k3_bgp_read_temp(data, temp);
 }
 
 static const struct thermal_zone_device_ops k3_of_thermal_ops = {
-- 
2.43.0


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

* [PATCH 32/36] USB: serial: ch341: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Johan Hovold, Greg Kroah-Hartman
  Cc: cocci, linux-kernel, linux-usb

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/usb/serial/ch341.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 569f4aede215..3de317bde07b 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -279,12 +279,8 @@ static int ch341_set_baudrate_lcr(struct usb_device *dev,
 	if (priv->version < 0x30)
 		return 0;
 
-	r = ch341_control_out(dev, CH341_REQ_WRITE_REG,
-			      CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr);
-	if (r)
-		return r;
-
-	return r;
+	return ch341_control_out(dev, CH341_REQ_WRITE_REG,
+				 CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr);
 }
 
 static int ch341_set_handshake(struct usb_device *dev, u8 control)
-- 
2.43.0


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

* [cocci] [PATCH 32/36] USB: serial: ch341: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Johan Hovold, Greg Kroah-Hartman
  Cc: cocci, linux-kernel, linux-usb

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/usb/serial/ch341.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 569f4aede215..3de317bde07b 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -279,12 +279,8 @@ static int ch341_set_baudrate_lcr(struct usb_device *dev,
 	if (priv->version < 0x30)
 		return 0;
 
-	r = ch341_control_out(dev, CH341_REQ_WRITE_REG,
-			      CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr);
-	if (r)
-		return r;
-
-	return r;
+	return ch341_control_out(dev, CH341_REQ_WRITE_REG,
+				 CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr);
 }
 
 static int ch341_set_handshake(struct usb_device *dev, u8 control)
-- 
2.43.0


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

* [PATCH 33/36] usb: typec: fusb302: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Heikki Krogerus, Greg Kroah-Hartman
  Cc: cocci, linux-kernel, linux-usb

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/usb/typec/tcpm/fusb302.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index 3319f6a2b0c9..d0ab247b24bf 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -314,11 +314,7 @@ static int fusb302_i2c_mask_write(struct fusb302_chip *chip, u8 address,
 		return ret;
 	data &= ~mask;
 	data |= value;
-	ret = fusb302_i2c_write(chip, address, data);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return fusb302_i2c_write(chip, address, data);
 }
 
 static int fusb302_i2c_set_bits(struct fusb302_chip *chip, u8 address,
@@ -375,12 +371,8 @@ static int fusb302_init_interrupt(struct fusb302_chip *chip)
 	ret = fusb302_i2c_write(chip, FUSB_REG_MASKB, 0xFF);
 	if (ret < 0)
 		return ret;
-	ret = fusb302_i2c_clear_bits(chip, FUSB_REG_CONTROL0,
-				     FUSB_REG_CONTROL0_INT_MASK);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return fusb302_i2c_clear_bits(chip, FUSB_REG_CONTROL0,
+				      FUSB_REG_CONTROL0_INT_MASK);
 }
 
 static int fusb302_set_power_mode(struct fusb302_chip *chip, u8 power_mode)
-- 
2.43.0


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

* [cocci] [PATCH 33/36] usb: typec: fusb302: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Heikki Krogerus, Greg Kroah-Hartman
  Cc: cocci, linux-kernel, linux-usb

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/usb/typec/tcpm/fusb302.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index 3319f6a2b0c9..d0ab247b24bf 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -314,11 +314,7 @@ static int fusb302_i2c_mask_write(struct fusb302_chip *chip, u8 address,
 		return ret;
 	data &= ~mask;
 	data |= value;
-	ret = fusb302_i2c_write(chip, address, data);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return fusb302_i2c_write(chip, address, data);
 }
 
 static int fusb302_i2c_set_bits(struct fusb302_chip *chip, u8 address,
@@ -375,12 +371,8 @@ static int fusb302_init_interrupt(struct fusb302_chip *chip)
 	ret = fusb302_i2c_write(chip, FUSB_REG_MASKB, 0xFF);
 	if (ret < 0)
 		return ret;
-	ret = fusb302_i2c_clear_bits(chip, FUSB_REG_CONTROL0,
-				     FUSB_REG_CONTROL0_INT_MASK);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return fusb302_i2c_clear_bits(chip, FUSB_REG_CONTROL0,
+				      FUSB_REG_CONTROL0_INT_MASK);
 }
 
 static int fusb302_set_power_mode(struct fusb302_chip *chip, u8 power_mode)
-- 
2.43.0


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

* [PATCH 34/36] smb: client: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Steve French
  Cc: cocci, Bharath SM, linux-cifs, linux-kernel, Paulo Alcantara,
	Ronnie Sahlberg, samba-technical, Shyam Prasad N, Tom Talpey

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>
---
 fs/smb/client/smb1maperror.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c
index ab3d09613c91..395299f9121b 100644
--- a/fs/smb/client/smb1maperror.c
+++ b/fs/smb/client/smb1maperror.c
@@ -234,11 +234,7 @@ int __init smb1_init_maperror(void)
 	if (rc)
 		return rc;
 
-	rc = mapping_table_ERRSRV_is_sorted();
-	if (rc)
-		return rc;
-
-	return rc;
+	return mapping_table_ERRSRV_is_sorted();
 }
 
 #if IS_ENABLED(CONFIG_SMB1_KUNIT_TESTS)
-- 
2.43.0


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

* [cocci] [PATCH 34/36] smb: client: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Steve French
  Cc: cocci, Bharath SM, linux-cifs, linux-kernel, Paulo Alcantara,
	Ronnie Sahlberg, samba-technical, Shyam Prasad N, Tom Talpey

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>
---
 fs/smb/client/smb1maperror.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c
index ab3d09613c91..395299f9121b 100644
--- a/fs/smb/client/smb1maperror.c
+++ b/fs/smb/client/smb1maperror.c
@@ -234,11 +234,7 @@ int __init smb1_init_maperror(void)
 	if (rc)
 		return rc;
 
-	rc = mapping_table_ERRSRV_is_sorted();
-	if (rc)
-		return rc;
-
-	return rc;
+	return mapping_table_ERRSRV_is_sorted();
 }
 
 #if IS_ENABLED(CONFIG_SMB1_KUNIT_TESTS)
-- 
2.43.0


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

* [PATCH 35/36] cpupower: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Thomas Renninger, Shuah Khan, John B. Wyatt IV,
	John Kacur
  Cc: cocci, linux-kernel, linux-pm

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>
---
 tools/power/cpupower/utils/powercap-info.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/power/cpupower/utils/powercap-info.c b/tools/power/cpupower/utils/powercap-info.c
index e53033488218..88a5edb76315 100644
--- a/tools/power/cpupower/utils/powercap-info.c
+++ b/tools/power/cpupower/utils/powercap-info.c
@@ -47,8 +47,6 @@ static int powercap_print_one_zone(struct powercap_zone *zone)
 
 	printf("\n");
 
-	if (ret != 0)
-		return ret;
 	return ret;
 }
 
-- 
2.43.0


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

* [cocci] [PATCH 35/36] cpupower: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Thomas Renninger, Shuah Khan, John B. Wyatt IV,
	John Kacur
  Cc: cocci, linux-kernel, linux-pm

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>
---
 tools/power/cpupower/utils/powercap-info.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/power/cpupower/utils/powercap-info.c b/tools/power/cpupower/utils/powercap-info.c
index e53033488218..88a5edb76315 100644
--- a/tools/power/cpupower/utils/powercap-info.c
+++ b/tools/power/cpupower/utils/powercap-info.c
@@ -47,8 +47,6 @@ static int powercap_print_one_zone(struct powercap_zone *zone)
 
 	printf("\n");
 
-	if (ret != 0)
-		return ret;
 	return ret;
 }
 
-- 
2.43.0


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

* [PATCH 36/36] memblock: remove conditional return with no effect
  2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  -1 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Mike Rapoport, Andrew Morton; +Cc: cocci, linux-kernel, linux-mm

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>
---
 mm/memblock.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 036316e9138b..6941fdaa3473 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2614,15 +2614,10 @@ static int __init prepare_kho_fdt(void)
 
 static int __init reserve_mem_init(void)
 {
-	int err;
-
 	if (!kho_is_enabled() || !reserved_mem_count)
 		return 0;
 
-	err = prepare_kho_fdt();
-	if (err)
-		return err;
-	return err;
+	return prepare_kho_fdt();
 }
 late_initcall(reserve_mem_init);
 
-- 
2.43.0


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

* [cocci] [PATCH 36/36] memblock: remove conditional return with no effect
@ 2026-07-23 18:45   ` Sang-Heon Jeon
  0 siblings, 0 replies; 101+ messages in thread
From: Sang-Heon Jeon @ 2026-07-23 18:45 UTC (permalink / raw)
  To: Julia.Lawall, Mike Rapoport, Andrew Morton; +Cc: cocci, linux-kernel, linux-mm

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>
---
 mm/memblock.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 036316e9138b..6941fdaa3473 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2614,15 +2614,10 @@ static int __init prepare_kho_fdt(void)
 
 static int __init reserve_mem_init(void)
 {
-	int err;
-
 	if (!kho_is_enabled() || !reserved_mem_count)
 		return 0;
 
-	err = prepare_kho_fdt();
-	if (err)
-		return err;
-	return err;
+	return prepare_kho_fdt();
 }
 late_initcall(reserve_mem_init);
 
-- 
2.43.0


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

* Re: [PATCH 08/36] net: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-23 19:04     ` Andrew Lunn
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* Re: [cocci] [PATCH 08/36] net: remove conditional return with no effect
@ 2026-07-23 19:04     ` Andrew Lunn
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* Re: [PATCH 27/36] RAS/AMD/ATL: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-23 19:44     ` Borislav Petkov
  -1 siblings, 0 replies; 101+ messages in thread
From: Borislav Petkov @ 2026-07-23 19:44 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Yazen Ghannam, Tony Luck, cocci, linux-edac,
	linux-kernel

On Fri, Jul 24, 2026 at 03:45:29AM +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/ras/amd/atl/map.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/ras/amd/atl/map.c b/drivers/ras/amd/atl/map.c
> index 24a05af747d5..4ec9333ef745 100644
> --- a/drivers/ras/amd/atl/map.c
> +++ b/drivers/ras/amd/atl/map.c
> @@ -771,9 +771,5 @@ int get_address_map(struct addr_ctx *ctx)
>  
>  	dump_address_map(&ctx->map);
>  
> -	ret = validate_address_map(ctx);
> -	if (ret)
> -		return ret;
> -
> -	return ret;
> +	return validate_address_map(ctx);
>  }
> -- 

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [cocci] [PATCH 27/36] RAS/AMD/ATL: remove conditional return with no effect
@ 2026-07-23 19:44     ` Borislav Petkov
  0 siblings, 0 replies; 101+ messages in thread
From: Borislav Petkov @ 2026-07-23 19:44 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Yazen Ghannam, Tony Luck, cocci, linux-edac,
	linux-kernel

On Fri, Jul 24, 2026 at 03:45:29AM +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/ras/amd/atl/map.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/ras/amd/atl/map.c b/drivers/ras/amd/atl/map.c
> index 24a05af747d5..4ec9333ef745 100644
> --- a/drivers/ras/amd/atl/map.c
> +++ b/drivers/ras/amd/atl/map.c
> @@ -771,9 +771,5 @@ int get_address_map(struct addr_ctx *ctx)
>  
>  	dump_address_map(&ctx->map);
>  
> -	ret = validate_address_map(ctx);
> -	if (ret)
> -		return ret;
> -
> -	return ret;
> +	return validate_address_map(ctx);
>  }
> -- 

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH 07/36] net: ethernet: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-23 20:24     ` Niklas Söderlund
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* Re: [cocci] [PATCH 07/36] net: ethernet: remove conditional return with no effect
@ 2026-07-23 20:24     ` Niklas Söderlund
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* Re: [PATCH 12/36] media: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-23 20:26     ` Niklas Söderlund
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* Re: [cocci] [PATCH 12/36] media: remove conditional return with no effect
@ 2026-07-23 20:26     ` Niklas Söderlund
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* Re: [PATCH 34/36] smb: client: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-23 20:27     ` Steve French
  -1 siblings, 0 replies; 101+ messages in thread
From: Steve French @ 2026-07-23 20:27 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Steve French, cocci, Bharath SM, linux-cifs,
	linux-kernel, Paulo Alcantara, Ronnie Sahlberg, samba-technical,
	Shyam Prasad N, Tom Talpey

You can add my Reviewed-by if it is not going through my tree.

Which tree do you want this changeset to go through?

On Thu, Jul 23, 2026 at 2:04 PM Sang-Heon Jeon <ekffu200098@gmail.com> 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>
> ---
>  fs/smb/client/smb1maperror.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c
> index ab3d09613c91..395299f9121b 100644
> --- a/fs/smb/client/smb1maperror.c
> +++ b/fs/smb/client/smb1maperror.c
> @@ -234,11 +234,7 @@ int __init smb1_init_maperror(void)
>         if (rc)
>                 return rc;
>
> -       rc = mapping_table_ERRSRV_is_sorted();
> -       if (rc)
> -               return rc;
> -
> -       return rc;
> +       return mapping_table_ERRSRV_is_sorted();
>  }
>
>  #if IS_ENABLED(CONFIG_SMB1_KUNIT_TESTS)
> --
> 2.43.0
>
>


-- 
Thanks,

Steve

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

* Re: [cocci] [PATCH 34/36] smb: client: remove conditional return with no effect
@ 2026-07-23 20:27     ` Steve French
  0 siblings, 0 replies; 101+ messages in thread
From: Steve French @ 2026-07-23 20:27 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Steve French, cocci, Bharath SM, linux-cifs,
	linux-kernel, Paulo Alcantara, Ronnie Sahlberg, samba-technical,
	Shyam Prasad N, Tom Talpey

You can add my Reviewed-by if it is not going through my tree.

Which tree do you want this changeset to go through?

On Thu, Jul 23, 2026 at 2:04 PM Sang-Heon Jeon <ekffu200098@gmail.com> 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>
> ---
>  fs/smb/client/smb1maperror.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c
> index ab3d09613c91..395299f9121b 100644
> --- a/fs/smb/client/smb1maperror.c
> +++ b/fs/smb/client/smb1maperror.c
> @@ -234,11 +234,7 @@ int __init smb1_init_maperror(void)
>         if (rc)
>                 return rc;
>
> -       rc = mapping_table_ERRSRV_is_sorted();
> -       if (rc)
> -               return rc;
> -
> -       return rc;
> +       return mapping_table_ERRSRV_is_sorted();
>  }
>
>  #if IS_ENABLED(CONFIG_SMB1_KUNIT_TESTS)
> --
> 2.43.0
>
>


-- 
Thanks,

Steve

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

* RE: [PATCH 07/36] net: ethernet: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-23 20:35     ` Kiyanovski, Arthur
  -1 siblings, 0 replies; 101+ 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] 101+ messages in thread

* RE: [cocci] [PATCH 07/36] net: ethernet: remove conditional return with no effect
@ 2026-07-23 20:35     ` Kiyanovski, Arthur
  0 siblings, 0 replies; 101+ 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] 101+ messages in thread

* Re: [PATCH 15/36] iio: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-23 21:46     ` Joshua Crofts
  -1 siblings, 0 replies; 101+ messages in thread
From: Joshua Crofts @ 2026-07-23 21:46 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Jonathan Cameron, Linus Walleij, cocci,
	Andy Shevchenko, David Lechner, linux-iio, linux-kernel,
	Nuno Sá

On Fri, 24 Jul 2026 03:45:17 +0900
Sang-Heon Jeon <ekffu200098@gmail.com> 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>
> ---

Good idea adding a cocci script for this!

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards,
Joshua Crofts

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

* Re: [cocci] [PATCH 15/36] iio: remove conditional return with no effect
@ 2026-07-23 21:46     ` Joshua Crofts
  0 siblings, 0 replies; 101+ messages in thread
From: Joshua Crofts @ 2026-07-23 21:46 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Jonathan Cameron, Linus Walleij, cocci,
	Andy Shevchenko, David Lechner, linux-iio, linux-kernel,
	Nuno Sá

On Fri, 24 Jul 2026 03:45:17 +0900
Sang-Heon Jeon <ekffu200098@gmail.com> 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>
> ---

Good idea adding a cocci script for this!

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards,
Joshua Crofts

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

* RE: [PATCH 10/36] wifi: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-24  0:37     ` Ping-Ke Shih
  -1 siblings, 0 replies; 101+ messages in thread
From: Ping-Ke Shih @ 2026-07-24  0:37 UTC (permalink / raw)
  To: Sang-Heon Jeon, Julia.Lawall@inria.fr, Miri Korenblit
  Cc: cocci@inria.fr, linux-kernel@vger.kernel.org,
	linux-wireless@vger.kernel.org

Sang-Heon Jeon <ekffu200098@gmail.com> 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/wireless/ath/ath6kl/init.c              | 6 +-----
>  drivers/net/wireless/intel/iwlwifi/mvm/link.c       | 6 +-----
>  drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 7 +------
>  drivers/net/wireless/realtek/rtw89/mac.c            | 6 +-----
>  drivers/net/wireless/realtek/rtw89/mac_be.c         | 6 +-----

Can you split into four patches for ath6k, iwlwifi, rtlwifi and rtw89?
Then we can apply the patch to individual tree. 

Ping-Ke


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

* RE: [cocci] [PATCH 10/36] wifi: remove conditional return with no effect
@ 2026-07-24  0:37     ` Ping-Ke Shih
  0 siblings, 0 replies; 101+ messages in thread
From: Ping-Ke Shih @ 2026-07-24  0:37 UTC (permalink / raw)
  To: Sang-Heon Jeon, Julia.Lawall@inria.fr, Miri Korenblit
  Cc: cocci@inria.fr, linux-kernel@vger.kernel.org,
	linux-wireless@vger.kernel.org

Sang-Heon Jeon <ekffu200098@gmail.com> 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/wireless/ath/ath6kl/init.c              | 6 +-----
>  drivers/net/wireless/intel/iwlwifi/mvm/link.c       | 6 +-----
>  drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 7 +------
>  drivers/net/wireless/realtek/rtw89/mac.c            | 6 +-----
>  drivers/net/wireless/realtek/rtw89/mac_be.c         | 6 +-----

Can you split into four patches for ath6k, iwlwifi, rtlwifi and rtw89?
Then we can apply the patch to individual tree. 

Ping-Ke


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

* Re: [PATCH 15/36] iio: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-24  0:38     ` Jonathan Cameron
  -1 siblings, 0 replies; 101+ messages in thread
From: Jonathan Cameron @ 2026-07-24  0:38 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Linus Walleij, cocci, Andy Shevchenko,
	David Lechner, linux-iio, linux-kernel, Nuno Sá

On Fri, 24 Jul 2026 03:45:17 +0900
Sang-Heon Jeon <ekffu200098@gmail.com> 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/iio/light/isl29028.c      |  6 +-----
>  drivers/iio/light/tsl2583.c       | 14 +++-----------
>  drivers/iio/magnetometer/ak8974.c |  6 +-----
>  3 files changed, 5 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c
> index b88e7c4eae3e..ea38d797082b 100644
> --- a/drivers/iio/light/isl29028.c
> +++ b/drivers/iio/light/isl29028.c
> @@ -405,11 +405,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = isl29028_set_pm_runtime_busy(chip, false);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return isl29028_set_pm_runtime_busy(chip, false);

That should have been a return 0.  The call to pm_runtime_put_auto_suspend()
can return positive (in theory anyway).  The intent here was probably to eat
that positive and ensure we return 0 or negative only from this function

Please split up a fix for this as a separate patch.

Even better if you have time would be to do that and then a second patch to
get rid of this helper that adds no obvious value.  Smells like code
that evolved into a slightly silly form!


>  }
>  
>  static int isl29028_read_raw(struct iio_dev *indio_dev,
> diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
> index a0dd122af2cf..a38a0130d854 100644
> --- a/drivers/iio/light/tsl2583.c
> +++ b/drivers/iio/light/tsl2583.c
> @@ -456,12 +456,8 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
>  
>  	usleep_range(3000, 3500);
>  
> -	ret = tsl2583_set_power_state(chip, TSL2583_CNTL_PWR_ON |
> -					    TSL2583_CNTL_ADC_ENBL);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return tsl2583_set_power_state(chip,
> +				       TSL2583_CNTL_PWR_ON | TSL2583_CNTL_ADC_ENBL);
>  }
>  
>  /* Sysfs Interface Functions */
> @@ -790,11 +786,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
>  		return ret;
>  	}
>  
> -	ret = tsl2583_set_pm_runtime_busy(chip, false);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return tsl2583_set_pm_runtime_busy(chip, false);
Similar to case above.   It should have been eating the positive return
by return 0;  Also the same suggested follow up cleanup applies in this driver.

>  }
>  
>  static const struct iio_info tsl2583_info = {
> diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
> index c7fdb7c2f543..c988d0e40cea 100644
> --- a/drivers/iio/magnetometer/ak8974.c
> +++ b/drivers/iio/magnetometer/ak8974.c
> @@ -379,11 +379,7 @@ static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
>  		return -ERANGE;
>  	}
>  
> -	ret = regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
> -	if (ret)
> -		return ret;
> -
> -	return ret;
> +	return regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
This one I agree with.

Thanks for looking at these.  I suspect you may want to take a closer
look at any other changes you've scripted that are similarl

When code is doing something silly it might just be that, or it might
be intended to do something not so silly!

Jonathan

>  }
>  
>  static irqreturn_t ak8974_drdy_irq(int irq, void *d)


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

* Re: [cocci] [PATCH 15/36] iio: remove conditional return with no effect
@ 2026-07-24  0:38     ` Jonathan Cameron
  0 siblings, 0 replies; 101+ messages in thread
From: Jonathan Cameron @ 2026-07-24  0:38 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Linus Walleij, cocci, Andy Shevchenko,
	David Lechner, linux-iio, linux-kernel, Nuno Sá

On Fri, 24 Jul 2026 03:45:17 +0900
Sang-Heon Jeon <ekffu200098@gmail.com> 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/iio/light/isl29028.c      |  6 +-----
>  drivers/iio/light/tsl2583.c       | 14 +++-----------
>  drivers/iio/magnetometer/ak8974.c |  6 +-----
>  3 files changed, 5 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c
> index b88e7c4eae3e..ea38d797082b 100644
> --- a/drivers/iio/light/isl29028.c
> +++ b/drivers/iio/light/isl29028.c
> @@ -405,11 +405,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = isl29028_set_pm_runtime_busy(chip, false);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return isl29028_set_pm_runtime_busy(chip, false);

That should have been a return 0.  The call to pm_runtime_put_auto_suspend()
can return positive (in theory anyway).  The intent here was probably to eat
that positive and ensure we return 0 or negative only from this function

Please split up a fix for this as a separate patch.

Even better if you have time would be to do that and then a second patch to
get rid of this helper that adds no obvious value.  Smells like code
that evolved into a slightly silly form!


>  }
>  
>  static int isl29028_read_raw(struct iio_dev *indio_dev,
> diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
> index a0dd122af2cf..a38a0130d854 100644
> --- a/drivers/iio/light/tsl2583.c
> +++ b/drivers/iio/light/tsl2583.c
> @@ -456,12 +456,8 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
>  
>  	usleep_range(3000, 3500);
>  
> -	ret = tsl2583_set_power_state(chip, TSL2583_CNTL_PWR_ON |
> -					    TSL2583_CNTL_ADC_ENBL);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return tsl2583_set_power_state(chip,
> +				       TSL2583_CNTL_PWR_ON | TSL2583_CNTL_ADC_ENBL);
>  }
>  
>  /* Sysfs Interface Functions */
> @@ -790,11 +786,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
>  		return ret;
>  	}
>  
> -	ret = tsl2583_set_pm_runtime_busy(chip, false);
> -	if (ret < 0)
> -		return ret;
> -
> -	return ret;
> +	return tsl2583_set_pm_runtime_busy(chip, false);
Similar to case above.   It should have been eating the positive return
by return 0;  Also the same suggested follow up cleanup applies in this driver.

>  }
>  
>  static const struct iio_info tsl2583_info = {
> diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
> index c7fdb7c2f543..c988d0e40cea 100644
> --- a/drivers/iio/magnetometer/ak8974.c
> +++ b/drivers/iio/magnetometer/ak8974.c
> @@ -379,11 +379,7 @@ static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
>  		return -ERANGE;
>  	}
>  
> -	ret = regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
> -	if (ret)
> -		return ret;
> -
> -	return ret;
> +	return regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
This one I agree with.

Thanks for looking at these.  I suspect you may want to take a closer
look at any other changes you've scripted that are similarl

When code is doing something silly it might just be that, or it might
be intended to do something not so silly!

Jonathan

>  }
>  
>  static irqreturn_t ak8974_drdy_irq(int irq, void *d)


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

* Re: [PATCH 14/36] ASoC: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-24  5:05     ` Mukunda,Vijendar
  -1 siblings, 0 replies; 101+ messages in thread
From: Mukunda,Vijendar @ 2026-07-24  5:05 UTC (permalink / raw)
  To: Sang-Heon Jeon, Julia.Lawall, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Cezary Rojewski, Peter Ujfalusi,
	Bard Liao, Kai Vehmanen, Sylwester Nawrocki, Daniel Baluta
  Cc: cocci, linux-kernel, linux-sound, Pierre-Louis Bossart,
	sound-open-firmware, Venkata Prasad Potturu



On 7/24/26 00:15, Sang-Heon Jeon wrote:
> [You don't often get email from ekffu200098@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> 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.
Could you please separate the changes in to vendor specific patches?
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---
>   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 +-----
>   4 files changed, 7 insertions(+), 25 deletions(-)
>
> diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
> index ef784cca13f2..01a0aaa60246 100644
> --- a/sound/soc/amd/acp/acp-mach-common.c
> +++ b/sound/soc/amd/acp/acp-mach-common.c
> @@ -938,15 +938,10 @@ static int acp_max98388_hw_params(struct snd_pcm_substream *substream,
>          struct snd_soc_dai *codec_dai =
>                          snd_soc_card_get_codec_dai(card,
>                                                     MAX98388_CODEC_DAI);
> -       int ret;
>
> -       ret = snd_soc_dai_set_fmt(codec_dai,
> -                                 SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
> -                                 SND_SOC_DAIFMT_NB_NF);
> -       if (ret < 0)
> -               return ret;
> -
> -       return ret;
> +       return snd_soc_dai_set_fmt(codec_dai,
> +                                  SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
> +                                  SND_SOC_DAIFMT_NB_NF);
>   }
>
>   static const struct snd_soc_ops acp_max98388_ops = {
> diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> index 9ee4d9926e06..a4c8cbfba096 100644
> --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> @@ -236,12 +236,7 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
>
>          stream->stream_info.str_id = str_params.stream_id;
>
> -       ret_val = stream->ops->open(sst->dev, &str_params);
> -       if (ret_val <= 0)
> -               return ret_val;
> -
> -
> -       return ret_val;
> +       return stream->ops->open(sst->dev, &str_params);
>   }
>
>   static void sst_period_elapsed(void *arg)
> diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c
> index 2474eb619882..515e4dfc1432 100644
> --- a/sound/soc/samsung/smdk_spdif.c
> +++ b/sound/soc/samsung/smdk_spdif.c
> @@ -130,12 +130,8 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
>                  return ret;
>
>          /* Set S/PDIF uses internal source clock */
> -       ret = snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
> -                                       rclk_rate, SND_SOC_CLOCK_IN);
> -       if (ret < 0)
> -               return ret;
> -
> -       return ret;
> +       return snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
> +                                     rclk_rate, SND_SOC_CLOCK_IN);
>   }
>
>   static const struct snd_soc_ops smdk_spdif_ops = {
> diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
> index e9f092f082a1..b9b2bdff4ccb 100644
> --- a/sound/soc/sof/intel/hda-dsp.c
> +++ b/sound/soc/sof/intel/hda-dsp.c
> @@ -1114,11 +1114,7 @@ static int hda_dsp_s5_quirk(struct snd_sof_dev *sdev)
>          usleep_range(500, 1000);
>
>          /* Restore state for shutdown, back to reset */
> -       ret = hda_dsp_ctrl_link_reset(sdev, true);
> -       if (ret < 0)
> -               return ret;
> -
> -       return ret;
> +       return hda_dsp_ctrl_link_reset(sdev, true);
>   }
>
>   int hda_dsp_shutdown_dma_flush(struct snd_sof_dev *sdev)
> --
> 2.43.0
>


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

* Re: [cocci] [PATCH 14/36] ASoC: remove conditional return with no effect
@ 2026-07-24  5:05     ` Mukunda,Vijendar
  0 siblings, 0 replies; 101+ messages in thread
From: Mukunda,Vijendar @ 2026-07-24  5:05 UTC (permalink / raw)
  To: Sang-Heon Jeon, Julia.Lawall, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Cezary Rojewski, Peter Ujfalusi,
	Bard Liao, Kai Vehmanen, Sylwester Nawrocki, Daniel Baluta
  Cc: cocci, linux-kernel, linux-sound, Pierre-Louis Bossart,
	sound-open-firmware, Venkata Prasad Potturu



On 7/24/26 00:15, Sang-Heon Jeon wrote:
> [You don't often get email from ekffu200098@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> 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.
Could you please separate the changes in to vendor specific patches?
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---
>   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 +-----
>   4 files changed, 7 insertions(+), 25 deletions(-)
>
> diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
> index ef784cca13f2..01a0aaa60246 100644
> --- a/sound/soc/amd/acp/acp-mach-common.c
> +++ b/sound/soc/amd/acp/acp-mach-common.c
> @@ -938,15 +938,10 @@ static int acp_max98388_hw_params(struct snd_pcm_substream *substream,
>          struct snd_soc_dai *codec_dai =
>                          snd_soc_card_get_codec_dai(card,
>                                                     MAX98388_CODEC_DAI);
> -       int ret;
>
> -       ret = snd_soc_dai_set_fmt(codec_dai,
> -                                 SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
> -                                 SND_SOC_DAIFMT_NB_NF);
> -       if (ret < 0)
> -               return ret;
> -
> -       return ret;
> +       return snd_soc_dai_set_fmt(codec_dai,
> +                                  SND_SOC_DAIFMT_CBC_CFC | SND_SOC_DAIFMT_I2S |
> +                                  SND_SOC_DAIFMT_NB_NF);
>   }
>
>   static const struct snd_soc_ops acp_max98388_ops = {
> diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> index 9ee4d9926e06..a4c8cbfba096 100644
> --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> @@ -236,12 +236,7 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
>
>          stream->stream_info.str_id = str_params.stream_id;
>
> -       ret_val = stream->ops->open(sst->dev, &str_params);
> -       if (ret_val <= 0)
> -               return ret_val;
> -
> -
> -       return ret_val;
> +       return stream->ops->open(sst->dev, &str_params);
>   }
>
>   static void sst_period_elapsed(void *arg)
> diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c
> index 2474eb619882..515e4dfc1432 100644
> --- a/sound/soc/samsung/smdk_spdif.c
> +++ b/sound/soc/samsung/smdk_spdif.c
> @@ -130,12 +130,8 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
>                  return ret;
>
>          /* Set S/PDIF uses internal source clock */
> -       ret = snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
> -                                       rclk_rate, SND_SOC_CLOCK_IN);
> -       if (ret < 0)
> -               return ret;
> -
> -       return ret;
> +       return snd_soc_dai_set_sysclk(cpu_dai, SND_SOC_SPDIF_INT_MCLK,
> +                                     rclk_rate, SND_SOC_CLOCK_IN);
>   }
>
>   static const struct snd_soc_ops smdk_spdif_ops = {
> diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
> index e9f092f082a1..b9b2bdff4ccb 100644
> --- a/sound/soc/sof/intel/hda-dsp.c
> +++ b/sound/soc/sof/intel/hda-dsp.c
> @@ -1114,11 +1114,7 @@ static int hda_dsp_s5_quirk(struct snd_sof_dev *sdev)
>          usleep_range(500, 1000);
>
>          /* Restore state for shutdown, back to reset */
> -       ret = hda_dsp_ctrl_link_reset(sdev, true);
> -       if (ret < 0)
> -               return ret;
> -
> -       return ret;
> +       return hda_dsp_ctrl_link_reset(sdev, true);
>   }
>
>   int hda_dsp_shutdown_dma_flush(struct snd_sof_dev *sdev)
> --
> 2.43.0
>


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

* Re: [PATCH 28/36] regulator: wm831x-isink: remove conditional return with no effect
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
@ 2026-07-24  8:24     ` Charles Keepax
  -1 siblings, 0 replies; 101+ messages in thread
From: Charles Keepax @ 2026-07-24  8:24 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Liam Girdwood, Mark Brown, cocci, linux-kernel,
	patches

On Fri, Jul 24, 2026 at 03:45:30AM +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: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [cocci] [PATCH 28/36] regulator: wm831x-isink: remove conditional return with no effect
@ 2026-07-24  8:24     ` Charles Keepax
  0 siblings, 0 replies; 101+ messages in thread
From: Charles Keepax @ 2026-07-24  8:24 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Julia.Lawall, Liam Girdwood, Mark Brown, cocci, linux-kernel,
	patches

On Fri, Jul 24, 2026 at 03:45:30AM +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: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [cocci] [PATCH 01/36] coccinelle: misc: add cond_return_no_effect.cocci
  2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
  (?)
@ 2026-07-24 11:19   ` Markus Elfring
  2026-07-24 11:38     ` Julia Lawall
  -1 siblings, 1 reply; 101+ messages in thread
From: Markus Elfring @ 2026-07-24 11:19 UTC (permalink / raw)
  To: Sang-Heon Jeon, cocci, Julia Lawall, Nicolas Palix; +Cc: LKML, kernel-janitors

…
> +++ b/scripts/coccinelle/misc/cond_return_no_effect.cocci
> @@ -0,0 +1,121 @@
> +@depends on patch@
> +local idexpression ret;
> +expression E;
> +binary operator cmp = {<, <=, >, >=, ==, !=};
> +constant C;
> +@@
> +-	ret = E;
> +-	if (\(ret \| !ret \| ret cmp C\))
> +-		return ret;
> +-	return ret;
> ++	return E;
> +
> +@depends on patch@
> +idexpression ret;
> +binary operator cmp = {<, <=, >, >=, ==, !=};
> +constant C;
> +@@
> +-	if (\(ret \| !ret \| ret cmp C\))
> +-		return ret;
> +	return ret;
…

How do you think about to combine such transformation rules
by using an SmPL disjunction?

Regards,
Markus

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

* Re: [cocci] [PATCH 01/36] coccinelle: misc: add cond_return_no_effect.cocci
  2026-07-24 11:19   ` Markus Elfring
@ 2026-07-24 11:38     ` Julia Lawall
  2026-07-24 11:47       ` Markus Elfring
  0 siblings, 1 reply; 101+ messages in thread
From: Julia Lawall @ 2026-07-24 11:38 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Sang-Heon Jeon, cocci, Nicolas Palix, LKML, kernel-janitors

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



On Fri, 24 Jul 2026, Markus Elfring wrote:

> …
> > +++ b/scripts/coccinelle/misc/cond_return_no_effect.cocci
> > @@ -0,0 +1,121 @@
> …
> > +@depends on patch@
> > +local idexpression ret;
> > +expression E;
> > +binary operator cmp = {<, <=, >, >=, ==, !=};
> > +constant C;
> > +@@
> > +-	ret = E;
> > +-	if (\(ret \| !ret \| ret cmp C\))
> > +-		return ret;
> > +-	return ret;
> > ++	return E;
> > +
> > +@depends on patch@
> > +idexpression ret;
> > +binary operator cmp = {<, <=, >, >=, ==, !=};
> > +constant C;
> > +@@
> > +-	if (\(ret \| !ret \| ret cmp C\))
> > +-		return ret;
> > +	return ret;
> …
>
> How do you think about to combine such transformation rules
> by using an SmPL disjunction?

I see no benefit to doing that.  In particular, the patterns search for
some code in common, but from different places, since one starts with an
assignment and the other starts with an if (that is common to both).

julia

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

* Re: [cocci] [PATCH 01/36] coccinelle: misc: add cond_return_no_effect.cocci
  2026-07-24 11:38     ` Julia Lawall
@ 2026-07-24 11:47       ` Markus Elfring
  0 siblings, 0 replies; 101+ messages in thread
From: Markus Elfring @ 2026-07-24 11:47 UTC (permalink / raw)
  To: Julia Lawall, cocci; +Cc: Sang-Heon Jeon, Nicolas Palix, LKML, kernel-janitors

>> …
>>> +++ b/scripts/coccinelle/misc/cond_return_no_effect.cocci
>>> @@ -0,0 +1,121 @@
>> …
>>> +@depends on patch@
>>> +local idexpression ret;
>>> +expression E;
>>> +binary operator cmp = {<, <=, >, >=, ==, !=};
>>> +constant C;
>>> +@@
>>> +-	ret = E;
>>> +-	if (\(ret \| !ret \| ret cmp C\))
>>> +-		return ret;
>>> +-	return ret;
>>> ++	return E;
>>> +
>>> +@depends on patch@
>>> +idexpression ret;
>>> +binary operator cmp = {<, <=, >, >=, ==, !=};
>>> +constant C;
>>> +@@
>>> +-	if (\(ret \| !ret \| ret cmp C\))
>>> +-		return ret;
>>> +	return ret;
>> …
>>
>> How do you think about to combine such transformation rules
>> by using an SmPL disjunction?
> 
> I see no benefit to doing that.

Can software run time characteristics be influenced in desirable directions
for such an use case?


>                                  In particular, the patterns search for
> some code in common, but from different places, since one starts with an
> assignment and the other starts with an if (that is common to both).

Would this implementation detail become interesting for corresponding refinements?

Regards,
Markus

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

end of thread, other threads:[~2026-07-24 11:47 UTC | newest]

Thread overview: 101+ 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 ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [Intel-wired-lan] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 01/36] coccinelle: misc: add cond_return_no_effect.cocci Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-24 11:19   ` Markus Elfring
2026-07-24 11:38     ` Julia Lawall
2026-07-24 11:47       ` Markus Elfring
2026-07-23 18:45 ` [PATCH 02/36] drm/amd: remove conditional return with no effect Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 03/36] drm/radeon: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 04/36] dpll: zl3073x: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 05/36] drm/i915: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 06/36] drm: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 07/36] net: ethernet: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 20:24   ` Niklas Söderlund
2026-07-23 20:24     ` [cocci] " Niklas Söderlund
2026-07-23 20:35   ` Kiyanovski, Arthur
2026-07-23 20:35     ` [cocci] " Kiyanovski, Arthur
2026-07-23 18:45 ` [PATCH 08/36] net: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 19:04   ` Andrew Lunn
2026-07-23 19:04     ` [cocci] " Andrew Lunn
2026-07-23 18:45 ` [Intel-wired-lan] [PATCH 09/36] net: intel: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45   ` Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 10/36] wifi: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-24  0:37   ` Ping-Ke Shih
2026-07-24  0:37     ` [cocci] " Ping-Ke Shih
2026-07-23 18:45 ` [PATCH 11/36] ipvs: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 12/36] media: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 20:26   ` Niklas Söderlund
2026-07-23 20:26     ` [cocci] " Niklas Söderlund
2026-07-23 18:45 ` [PATCH 13/36] ALSA: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 14/36] ASoC: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-24  5:05   ` Mukunda,Vijendar
2026-07-24  5:05     ` [cocci] " Mukunda,Vijendar
2026-07-23 18:45 ` [PATCH 15/36] iio: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 21:46   ` Joshua Crofts
2026-07-23 21:46     ` [cocci] " Joshua Crofts
2026-07-24  0:38   ` Jonathan Cameron
2026-07-24  0:38     ` [cocci] " Jonathan Cameron
2026-07-23 18:45 ` [PATCH 16/36] Input: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 17/36] clk: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 18/36] crypto: drivers - " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 19/36] dmaengine: qcom_hidma: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 20/36] stm class: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 21/36] RDMA/ocrdma: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 22/36] iommu/s390: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 23/36] dm vdo: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 24/36] pinctrl: mediatek: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 25/36] platform/x86: toshiba_haps: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 26/36] power: supply: pm8916_lbc: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 27/36] RAS/AMD/ATL: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 19:44   ` Borislav Petkov
2026-07-23 19:44     ` [cocci] " Borislav Petkov
2026-07-23 18:45 ` [PATCH 28/36] regulator: wm831x-isink: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-24  8:24   ` Charles Keepax
2026-07-24  8:24     ` [cocci] " Charles Keepax
2026-07-23 18:45 ` [PATCH 29/36] rtc: pcf2127: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 30/36] scsi: mpt3sas: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 31/36] thermal/drivers/k3_bandgap: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 32/36] USB: serial: ch341: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 33/36] usb: typec: fusb302: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 34/36] smb: client: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 20:27   ` Steve French
2026-07-23 20:27     ` [cocci] " Steve French
2026-07-23 18:45 ` [PATCH 35/36] cpupower: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon
2026-07-23 18:45 ` [PATCH 36/36] memblock: " Sang-Heon Jeon
2026-07-23 18:45   ` [cocci] " Sang-Heon Jeon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.