[agd5f:drm-next 156/217] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5749:52: warning: variable 'timing_diff' is uninitialized when used here

From: kernel test robot
Date: Wed Jul 21 2021 - 11:09:01 EST


tree: https://gitlab.freedesktop.org/agd5f/linux.git drm-next
head: e37e31def0dab2c3a5a97044d484382671517cf4
commit: efeedd3b1a2b06077745fc0a287bc84784bd359a [156/217] drm/amd/display: Add common rates of vide mode matching for freesync_video_mode
config: powerpc-buildonly-randconfig-r003-20210720 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c781eb153bfbd1b52b03efe34f56bbeccbb8aba6)
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
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
git remote add agd5f https://gitlab.freedesktop.org/agd5f/linux.git
git fetch --no-tags agd5f drm-next
git checkout efeedd3b1a2b06077745fc0a287bc84784bd359a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:29:
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29:
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:30:
In file included from include/linux/kgdb.h:18:
In file included from include/linux/atomic.h:7:
In file included from arch/powerpc/include/asm/atomic.h:11:
In file included from arch/powerpc/include/asm/cmpxchg.h:8:
In file included from include/linux/bug.h:5:
In file included from arch/powerpc/include/asm/bug.h:109:
In file included from include/asm-generic/bug.h:20:
In file included from include/linux/kernel.h:12:
In file included from include/linux/bitops.h:32:
In file included from arch/powerpc/include/asm/bitops.h:62:
arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined [-Wmacro-redefined]
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
^
<built-in>:310:9: note: previous definition is here
#define __lwsync __builtin_ppc_lwsync
^
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5749:52: warning: variable 'timing_diff' is uninitialized when used here [-Wuninitialized]
high_mode->vsync_start - mode->vsync_start != timing_diff ||
^~~~~~~~~~~
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5734:17: note: initialize the variable 'timing_diff' to silence this warning
int timing_diff;
^
= 0
2 warnings generated.


vim +/timing_diff +5749 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

a85ba00538cd4bb Nikola Cornij 2021-03-15 5714
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5715 /* Standard FPS values
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5716 *
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5717 * 23.976 - TV/NTSC
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5718 * 24 - Cinema
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5719 * 25 - TV/PAL
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5720 * 29.97 - TV/NTSC
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5721 * 30 - TV/NTSC
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5722 * 48 - Cinema HFR
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5723 * 50 - TV/PAL
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5724 * 60 - Commonly used
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5725 * 48,72,96 - Multiples of 24
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5726 */
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5727 const uint32_t common_rates[] = { 23976, 24000, 25000, 29970, 30000,
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5728 48000, 50000, 60000, 72000, 96000 };
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5729
fe8858bb097ba34 Nikola Cornij 2021-03-26 5730 static bool is_freesync_video_mode(const struct drm_display_mode *mode,
a85ba00538cd4bb Nikola Cornij 2021-03-15 5731 struct amdgpu_dm_connector *aconnector)
a85ba00538cd4bb Nikola Cornij 2021-03-15 5732 {
a85ba00538cd4bb Nikola Cornij 2021-03-15 5733 struct drm_display_mode *high_mode;
a85ba00538cd4bb Nikola Cornij 2021-03-15 5734 int timing_diff;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5735 int i;
a85ba00538cd4bb Nikola Cornij 2021-03-15 5736
a85ba00538cd4bb Nikola Cornij 2021-03-15 5737 high_mode = get_highest_refresh_rate_mode(aconnector, false);
a85ba00538cd4bb Nikola Cornij 2021-03-15 5738 if (!high_mode || !mode)
a85ba00538cd4bb Nikola Cornij 2021-03-15 5739 return false;
a85ba00538cd4bb Nikola Cornij 2021-03-15 5740
a85ba00538cd4bb Nikola Cornij 2021-03-15 5741 if (high_mode->clock == 0 || high_mode->clock != mode->clock ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5742 high_mode->hdisplay != mode->hdisplay ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5743 high_mode->vdisplay != mode->vdisplay ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5744 high_mode->hsync_start != mode->hsync_start ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5745 high_mode->hsync_end != mode->hsync_end ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5746 high_mode->htotal != mode->htotal ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5747 high_mode->hskew != mode->hskew ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5748 high_mode->vscan != mode->vscan ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 @5749 high_mode->vsync_start - mode->vsync_start != timing_diff ||
a85ba00538cd4bb Nikola Cornij 2021-03-15 5750 high_mode->vsync_end - mode->vsync_end != timing_diff)
a85ba00538cd4bb Nikola Cornij 2021-03-15 5751 return false;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5752
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5753 for (i = 0; i < ARRAY_SIZE(common_rates); i++) {
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5754 uint64_t target_vtotal, target_vtotal_diff;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5755 uint64_t num, den;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5756
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5757 if (drm_mode_vrefresh(high_mode) * 1000 < common_rates[i])
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5758 continue;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5759 if (common_rates[i] < aconnector->min_vfreq * 1000 ||
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5760 common_rates[i] > aconnector->max_vfreq * 1000)
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5761 continue;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5762 num = (unsigned long long)high_mode->clock * 1000 * 1000;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5763 den = common_rates[i] * (unsigned long long)high_mode->htotal;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5764 target_vtotal = div_u64(num, den);
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5765 target_vtotal_diff = target_vtotal - high_mode->vtotal;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5766
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5767 if ((mode->vtotal - target_vtotal_diff) == high_mode->vtotal)
a85ba00538cd4bb Nikola Cornij 2021-03-15 5768 return true;
a85ba00538cd4bb Nikola Cornij 2021-03-15 5769 }
a85ba00538cd4bb Nikola Cornij 2021-03-15 5770
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5771 return false;
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5772 }
efeedd3b1a2b060 Solomon Chiu 2021-07-19 5773

:::::: The code at line 5749 was first introduced by commit
:::::: a85ba00538cd4bb0655aaf57fe3ebf8cc21f4fea drm/amdgpu/display: re-enable freesync video patches

:::::: TO: Nikola Cornij <nikola.cornij@xxxxxxx>
:::::: CC: Alex Deucher <alexander.deucher@xxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip