[PATCH] drm/dp: Remove dead code after return statement

Len Bao posted 1 patch 3 months ago
There is a newer version of this series
drivers/gpu/drm/display/drm_dp_helper.c | 4 ----
1 file changed, 4 deletions(-)
[PATCH] drm/dp: Remove dead code after return statement
Posted by Len Bao 3 months ago
Coverity noticed that the code after the return statement in the
"drm_dp_pcon_frl_configure_2" function is never reached. So, it can be
safely removed.

Coverity-id: 1648885
Fixes: af67978ee37e5 ("drm/display: dp: use new DCPD access helpers")
Signed-off-by: Len Bao <len.bao@gmx.us>
---
 drivers/gpu/drm/display/drm_dp_helper.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index dc622c78d..de047e30d 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -3586,10 +3586,6 @@ int drm_dp_pcon_frl_configure_2(struct drm_dp_aux *aux, int max_frl_mask,
 		buf &= ~DP_PCON_FRL_LINK_TRAIN_EXTENDED;
 
 	return drm_dp_dpcd_write_byte(aux, DP_PCON_HDMI_LINK_CONFIG_2, buf);
-	if (ret < 0)
-		return ret;
-
-	return 0;
 }
 EXPORT_SYMBOL(drm_dp_pcon_frl_configure_2);
 
-- 
2.43.0
Re: [PATCH] drm/dp: Remove dead code after return statement
Posted by kernel test robot 3 months ago
Hi Len,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.16-rc4 next-20250704]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Len-Bao/drm-dp-Remove-dead-code-after-return-statement/20250707-002653
base:   linus/master
patch link:    https://lore.kernel.org/r/20250706162431.15029-1-len.bao%40gmx.us
patch subject: [PATCH] drm/dp: Remove dead code after return statement
config: arm-randconfig-002-20250707 (https://download.01.org/0day-ci/archive/20250707/202507070237.Hwcze8au-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250707/202507070237.Hwcze8au-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507070237.Hwcze8au-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/display/drm_dp_helper.c: In function 'drm_dp_pcon_frl_configure_2':
>> drivers/gpu/drm/display/drm_dp_helper.c:3580:13: warning: unused variable 'ret' [-Wunused-variable]
    3580 |         int ret;
         |             ^~~


vim +/ret +3580 drivers/gpu/drm/display/drm_dp_helper.c

ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3565  
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3566  /**
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3567   * drm_dp_pcon_frl_configure_2() - Set HDMI Link configuration Step-2
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3568   * @aux: DisplayPort AUX channel
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3569   * @max_frl_mask : Max FRL BW to be tried by the PCON with HDMI Sink
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3570   * @frl_type : FRL training type, can be Extended, or Normal.
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3571   * In Normal FRL training, the PCON tries each frl bw from the max_frl_mask
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3572   * starting from min, and stops when link training is successful. In Extended
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3573   * FRL training, all frl bw selected in the mask are trained by the PCON.
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3574   *
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3575   * Returns 0 if success, else returns negative error code.
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3576   */
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3577  int drm_dp_pcon_frl_configure_2(struct drm_dp_aux *aux, int max_frl_mask,
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3578  				u8 frl_type)
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3579  {
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18 @3580  	int ret;
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3581  	u8 buf = max_frl_mask;
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3582  
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3583  	if (frl_type == DP_PCON_FRL_LINK_TRAIN_EXTENDED)
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3584  		buf |= DP_PCON_FRL_LINK_TRAIN_EXTENDED;
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3585  	else
68a8c645b2538c drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2021-03-23  3586  		buf &= ~DP_PCON_FRL_LINK_TRAIN_EXTENDED;
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3587  
af67978ee37e54 drivers/gpu/drm/display/drm_dp_helper.c Dmitry Baryshkov 2025-03-24  3588  	return drm_dp_dpcd_write_byte(aux, DP_PCON_HDMI_LINK_CONFIG_2, buf);
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3589  }
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3590  EXPORT_SYMBOL(drm_dp_pcon_frl_configure_2);
ce32a6239de648 drivers/gpu/drm/drm_dp_helper.c         Ankit Nautiyal   2020-12-18  3591  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki