[tegra-drm:drm/tegra/for-next 16/17] drivers/gpu/drm/tegra/dc.c:1843:53: warning: variable 'new_dc_state' set but not used

Dmitry Osipenko digetx at gmail.com
Fri Aug 13 17:12:24 UTC 2021


13.08.2021 19:36, kernel test robot пишет:
> tree:   git://anongit.freedesktop.org/tegra/linux.git drm/tegra/for-next
> head:   ad85b0843ee4536593415ca890d7fb52cd7f1fbe
> commit: 04d5d5df9df79f9045e76404775fc8a084aac23d [16/17] drm/tegra: dc: Support memory bandwidth management
> config: arm-defconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         git remote add tegra-drm git://anongit.freedesktop.org/tegra/linux.git
>         git fetch --no-tags tegra-drm drm/tegra/for-next
>         git checkout 04d5d5df9df79f9045e76404775fc8a084aac23d
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp at intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/gpu/drm/tegra/dc.c: In function 'tegra_crtc_update_memory_bandwidth':
>>> drivers/gpu/drm/tegra/dc.c:1843:53: warning: variable 'new_dc_state' set but not used [-Wunused-but-set-variable]
>     1843 |         const struct tegra_dc_state *old_dc_state, *new_dc_state;
>          |                                                     ^~~~~~~~~~~~
>>> drivers/gpu/drm/tegra/dc.c:1843:38: warning: variable 'old_dc_state' set but not used [-Wunused-but-set-variable]
>     1843 |         const struct tegra_dc_state *old_dc_state, *new_dc_state;
>          |                                      ^~~~~~~~~~~~
>    drivers/gpu/drm/tegra/dc.c: In function 'tegra_crtc_calculate_memory_bandwidth':
>>> drivers/gpu/drm/tegra/dc.c:2223:38: warning: variable 'old_state' set but not used [-Wunused-but-set-variable]
>     2223 |         const struct drm_crtc_state *old_state;
>          |                                      ^~~~~~~~~
> 
> 
> vim +/new_dc_state +1843 drivers/gpu/drm/tegra/dc.c
> 
>   1836	
>   1837	static void
>   1838	tegra_crtc_update_memory_bandwidth(struct drm_crtc *crtc,
>   1839					   struct drm_atomic_state *state,
>   1840					   bool prepare_bandwidth_transition)
>   1841	{
>   1842		const struct tegra_plane_state *old_tegra_state, *new_tegra_state;
>> 1843		const struct tegra_dc_state *old_dc_state, *new_dc_state;
>   1844		u32 i, new_avg_bw, old_avg_bw, new_peak_bw, old_peak_bw;
>   1845		const struct drm_plane_state *old_plane_state;
>   1846		const struct drm_crtc_state *old_crtc_state;
>   1847		struct tegra_dc_window window, old_window;
>   1848		struct tegra_dc *dc = to_tegra_dc(crtc);
>   1849		struct tegra_plane *tegra;
>   1850		struct drm_plane *plane;
>   1851	
>   1852		if (dc->soc->has_nvdisplay)
>   1853			return;
>   1854	
>   1855		old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
>   1856		old_dc_state = to_const_dc_state(old_crtc_state);
>   1857		new_dc_state = to_const_dc_state(crtc->state);

I probably should update compiler or set W=1 to get that warning. These variables were used in older versions of the patch and they can be removed now.

Please amend the patch with this:

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 9ebb1b6840c6..e2b806369eac 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1908,7 +1908,6 @@ tegra_crtc_update_memory_bandwidth(struct drm_crtc *crtc,
 				   bool prepare_bandwidth_transition)
 {
 	const struct tegra_plane_state *old_tegra_state, *new_tegra_state;
-	const struct tegra_dc_state *old_dc_state, *new_dc_state;
 	u32 i, new_avg_bw, old_avg_bw, new_peak_bw, old_peak_bw;
 	const struct drm_plane_state *old_plane_state;
 	const struct drm_crtc_state *old_crtc_state;
@@ -1921,8 +1920,6 @@ tegra_crtc_update_memory_bandwidth(struct drm_crtc *crtc,
 		return;
 
 	old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
-	old_dc_state = to_const_dc_state(old_crtc_state);
-	new_dc_state = to_const_dc_state(crtc->state);
 
 	if (!crtc->state->active) {
 		if (!old_crtc_state->active)
diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h
index 26ad1e448c44..871cfb0cd31c 100644
--- a/drivers/gpu/drm/tegra/dc.h
+++ b/drivers/gpu/drm/tegra/dc.h
@@ -35,12 +35,6 @@ static inline struct tegra_dc_state *to_dc_state(struct drm_crtc_state *state)
 	return NULL;
 }
 
-static inline const struct tegra_dc_state *
-to_const_dc_state(const struct drm_crtc_state *state)
-{
-	return to_dc_state((struct drm_crtc_state *)state);
-}
-
 struct tegra_dc_stats {
 	unsigned long frames;
 	unsigned long vblank;




More information about the dri-devel mailing list