Skip to contentSkip to conversation

drm/i915: remove unreachable code

PATCH In review Yang Li 3 participants 4 messages May 31, 2023

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 drm/i915: remove unreachable code

The code after the return will not be executed, so remove them.

Eliminate the following warning:
drivers/gpu/drm/i915/display/intel_color.c:1808 intel_color_prepare_commit() warn: ignoring unreachable code.

---
 drivers/gpu/drm/i915/display/intel_color.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/i915/display/intel_color.c +0 -5
index 8966e6560516..0bfebac1e3e2 100644
@@ -1804,11 +1804,6 @@ void intel_color_prepare_commit(struct intel_crtc_state *crtc_state)
 
 	/* FIXME DSB has issues loading LUTs, disable it for now */
 	return;
-
-	if (!crtc_state->pre_csc_lut && !crtc_state->post_csc_lut)
-		return;
-
-	crtc_state->dsb = intel_dsb_prepare(crtc, 1024);
 }
 
 void intel_color_cleanup_commit(struct intel_crtc_state *crtc_state)
Signature · 1 line
2.20.1.7.g153144c
Reviewed-by on v1 1/1
#1 lore raw

Hi Yang,

Quoted 17 lines · Yang Li

The code after the return will not be executed, so remove them.

Eliminate the following warning:
drivers/gpu/drm/i915/display/intel_color.c:1808 intel_color_prepare_commit() warn: ignoring unreachable code.

---
 drivers/gpu/drm/i915/display/intel_color.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/i915/display/intel_color.c +0 -0
index 8966e6560516..0bfebac1e3e2 100644

drivers/gpu/drm/i915/display/intel_color.c void intel_color_prepare_commit(struct intel_crtc_state *crtc_state) · line 1811

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_color.c +0 -5
@@ -1804,11 +1804,6 @@ void intel_color_prepare_commit(struct intel_crtc_state *crtc_state)
 
 	/* FIXME DSB has issues loading LUTs, disable it for now */
 	return;
-
-	if (!crtc_state->pre_csc_lut && !crtc_state->post_csc_lut)
-		return;
-
-	crtc_state->dsb = intel_dsb_prepare(crtc, 1024);

yeah... it's an ugly bit, from my side:

but would be nice to hear from Ville who has added the return in a first place.

Andi

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_color.c +0 -0
 }
 
 void intel_color_cleanup_commit(struct intel_crtc_state *crtc_state)
Signature · 1 line
2.20.1.7.g153144c
#2 lore raw
In reply to Yang Li
kernel test robot noticed the following build errors:

Hi Yang,

kernel test robot noticed the following build errors:

[auto build test ERROR on next-20230530]

url:    https://github.com/intel-lab-lkp/linux/commits/Yang-Li/drm-i915-remove-unreachable-code/20230531-101832
base:   next-20230530
patch link:    https://lore.kernel.org/r/20230531021714.125078-1-yang.lee%40linux.alibaba.com
patch subject: [PATCH -next] drm/i915: remove unreachable code
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20230531/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/58232a66b9d21d80bc6b478e2a8fb1443da3adfc
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yang-Li/drm-i915-remove-unreachable-code/20230531-101832
        git checkout 58232a66b9d21d80bc6b478e2a8fb1443da3adfc
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/gpu/drm/i915/display/intel_color.c: In function 'intel_color_prepare_commit':

>> drivers/gpu/drm/i915/display/intel_color.c:1803:28: error: unused variable 'crtc' [-Werror=unused-variable]
    1803 |         struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
         |                            ^~~~

cc1: all warnings being treated as errors

vim +/crtc +1803 drivers/gpu/drm/i915/display/intel_color.c

3962ca4e080a52 Ville Syrjälä 2023-03-20  1800  
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1801  void intel_color_prepare_commit(struct intel_crtc_state *crtc_state)
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1802  {
b358c3b98813b1 Ville Syrjälä 2022-11-23 @1803  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
b358c3b98813b1 Ville Syrjälä 2022-11-23  1804  
2487ae0bcb53a7 Ville Syrjälä 2022-11-23  1805  	/* FIXME DSB has issues loading LUTs, disable it for now */
2487ae0bcb53a7 Ville Syrjälä 2022-11-23  1806  	return;
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1807  }
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1808  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw
In reply to Yang Li
kernel test robot noticed the following build warnings:

Hi Yang,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20230530]

url:    https://github.com/intel-lab-lkp/linux/commits/Yang-Li/drm-i915-remove-unreachable-code/20230531-101832
base:   next-20230530
patch link:    https://lore.kernel.org/r/20230531021714.125078-1-yang.lee%40linux.alibaba.com
patch subject: [PATCH -next] drm/i915: remove unreachable code
config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20230601/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/58232a66b9d21d80bc6b478e2a8fb1443da3adfc
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yang-Li/drm-i915-remove-unreachable-code/20230531-101832
        git checkout 58232a66b9d21d80bc6b478e2a8fb1443da3adfc
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/gpu/drm/i915/display/intel_color.c: In function 'intel_color_prepare_commit':

>> drivers/gpu/drm/i915/display/intel_color.c:1803:28: warning: unused variable 'crtc' [-Wunused-variable]
    1803 |         struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
         |                            ^~~~

vim +/crtc +1803 drivers/gpu/drm/i915/display/intel_color.c

3962ca4e080a52 Ville Syrjälä 2023-03-20  1800  
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1801  void intel_color_prepare_commit(struct intel_crtc_state *crtc_state)
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1802  {
b358c3b98813b1 Ville Syrjälä 2022-11-23 @1803  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
b358c3b98813b1 Ville Syrjälä 2022-11-23  1804  
2487ae0bcb53a7 Ville Syrjälä 2022-11-23  1805  	/* FIXME DSB has issues loading LUTs, disable it for now */
2487ae0bcb53a7 Ville Syrjälä 2022-11-23  1806  	return;
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1807  }
efb2b57edf20c3 Ville Syrjälä 2022-11-23  1808  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki