All of lore.kernel.org
 help / color / mirror / Atom feed
* [kraxel:drm-misc-next 3/7] drivers/gpu/drm/vc4/vc4_hdmi.c:1323:3: warning: Value stored to 'tmds_char_rate' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-04-01  6:27 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-04-01  6:27 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Maxime Ripard <maxime@cerno.tech>

tree:   git://git.kraxel.org/linux drm-misc-next
head:   e769a3504e273309c9fe4a417d427c8dbff4cf1c
commit: 595dcf4eb859d043de9919f50d44272304e75422 [3/7] drm/vc4: hdmi: Move clock calculation into its own function
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: arm-randconfig-c002-20220331 (https://download.01.org/0day-ci/archive/20220401/202204011417.pQUMEXTr-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        git remote add kraxel git://git.kraxel.org/linux
        git fetch --no-tags kraxel drm-misc-next
        git checkout 595dcf4eb859d043de9919f50d44272304e75422
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           ^
   include/linux/spinlock.h:264:3: note: expanded from macro 'raw_spin_lock_irqsave'
                   _raw_spin_lock_irqsave(lock, flags);    \
                   ^
   include/linux/spinlock_api_up.h:69:45: note: expanded from macro '_raw_spin_lock_irqsave'
   #define _raw_spin_lock_irqsave(lock, flags)     __LOCK_IRQSAVE(lock, flags)
                                                   ^
   include/linux/spinlock_api_up.h:40:31: note: expanded from macro '__LOCK_IRQSAVE'
     do { local_irq_save(flags); __LOCK(lock); } while (0)
                                 ^
   include/linux/spinlock_api_up.h:31:27: note: expanded from macro '__LOCK'
     do { preempt_disable(); ___LOCK(lock); } while (0)
                             ^
   include/linux/spinlock_api_up.h:28:3: note: expanded from macro '___LOCK'
     do { __acquire(lock); (void)(lock); } while (0)
     ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:1205:3: note: Loop condition is false.  Exiting loop
                   spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
                   ^
   include/linux/spinlock.h:379:2: note: expanded from macro 'spin_lock_irqsave'
           raw_spin_lock_irqsave(spinlock_check(lock), flags);     \
           ^
   include/linux/spinlock.h:264:3: note: expanded from macro 'raw_spin_lock_irqsave'
                   _raw_spin_lock_irqsave(lock, flags);    \
                   ^
   include/linux/spinlock_api_up.h:69:45: note: expanded from macro '_raw_spin_lock_irqsave'
   #define _raw_spin_lock_irqsave(lock, flags)     __LOCK_IRQSAVE(lock, flags)
                                                   ^
   include/linux/spinlock_api_up.h:40:31: note: expanded from macro '__LOCK_IRQSAVE'
     do { local_irq_save(flags); __LOCK(lock); } while (0)
                                 ^
   include/linux/spinlock_api_up.h:31:3: note: expanded from macro '__LOCK'
     do { preempt_disable(); ___LOCK(lock); } while (0)
     ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:1205:3: note: Loop condition is false.  Exiting loop
                   spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
                   ^
   include/linux/spinlock.h:379:2: note: expanded from macro 'spin_lock_irqsave'
           raw_spin_lock_irqsave(spinlock_check(lock), flags);     \
           ^
   include/linux/spinlock.h:264:3: note: expanded from macro 'raw_spin_lock_irqsave'
                   _raw_spin_lock_irqsave(lock, flags);    \
                   ^
   include/linux/spinlock_api_up.h:69:45: note: expanded from macro '_raw_spin_lock_irqsave'
   #define _raw_spin_lock_irqsave(lock, flags)     __LOCK_IRQSAVE(lock, flags)
                                                   ^
   include/linux/spinlock_api_up.h:40:3: note: expanded from macro '__LOCK_IRQSAVE'
     do { local_irq_save(flags); __LOCK(lock); } while (0)
     ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:1205:3: note: Loop condition is false.  Exiting loop
                   spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
                   ^
   include/linux/spinlock.h:379:2: note: expanded from macro 'spin_lock_irqsave'
           raw_spin_lock_irqsave(spinlock_check(lock), flags);     \
           ^
   include/linux/spinlock.h:262:2: note: expanded from macro 'raw_spin_lock_irqsave'
           do {                                            \
           ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:1205:3: note: Loop condition is false.  Exiting loop
                   spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
                   ^
   include/linux/spinlock.h:377:43: note: expanded from macro 'spin_lock_irqsave'
   #define spin_lock_irqsave(lock, flags)                          \
                                                                   ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:1207:11: note: Assuming the condition is false
                   WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
                           ^
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/gpu/drm/vc4/vc4_hdmi.c:1207:3: note: Taking false branch
                   WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
                   ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:1218:3: note: Calling 'vc4_hdmi_set_infoframes'
                   vc4_hdmi_set_infoframes(encoder);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_hdmi.c:570:2: note: Loop condition is false.  Exiting loop
           lockdep_assert_held(&vc4_hdmi->mutex);
           ^
   include/linux/lockdep.h:411:34: note: expanded from macro 'lockdep_assert_held'
   #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
                                                   ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:578:6: note: Assuming field 'streaming' is true
           if (vc4_hdmi->audio.streaming)
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_hdmi.c:578:2: note: Taking true branch
           if (vc4_hdmi->audio.streaming)
           ^
   drivers/gpu/drm/vc4/vc4_hdmi.c:579:3: note: Calling 'vc4_hdmi_set_audio_infoframe'
                   vc4_hdmi_set_audio_infoframe(encoder);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_hdmi.c:542:2: note: Calling 'vc4_hdmi_write_infoframe'
           vc4_hdmi_write_infoframe(encoder, &frame);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_hdmi.c:437:34: note: The left operand of '-' is a garbage value
           u32 packet_id = frame->any.type - 0x80;
                           ~~~~~~~~~~~~~~~ ^
>> drivers/gpu/drm/vc4/vc4_hdmi.c:1323:3: warning: Value stored to 'tmds_char_rate' is never read [clang-analyzer-deadcode.DeadStores]
                   tmds_char_rate = mode->clock * 1000;
                   ^                ~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vc4/vc4_hdmi.c:1323:3: note: Value stored to 'tmds_char_rate' is never read
                   tmds_char_rate = mode->clock * 1000;
                   ^                ~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:88:44: warning: The left operand of '-' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
           return ((sublinks & 1) ? sor[0] : sor[1]) - 1;
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:72:2: note: Loop condition is true.  Entering loop body
           for (*link = 0, m = __ffs(outp->info.or) * 2, s = 0; s < 2; m++, s++) {
           ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:73:7: note: Assuming the condition is false
                   if (sublinks & BIT(s)) {
                       ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:73:3: note: Taking false branch
                   if (sublinks & BIT(s)) {
                   ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:72:2: note: Loop condition is true.  Entering loop body
           for (*link = 0, m = __ffs(outp->info.or) * 2, s = 0; s < 2; m++, s++) {
           ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:73:7: note: Assuming the condition is false
                   if (sublinks & BIT(s)) {
                       ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:73:3: note: Taking false branch
                   if (sublinks & BIT(s)) {
                   ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:72:2: note: Loop condition is false. Execution continues on line 83
           for (*link = 0, m = __ffs(outp->info.or) * 2, s = 0; s < 2; m++, s++) {
           ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:83:6: note: 'sublinks' is not equal to 3
           if (sublinks == 3) {
               ^~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:83:2: note: Taking false branch
           if (sublinks == 3) {
           ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:88:11: note: Assuming the condition is false
           return ((sublinks & 1) ? sor[0] : sor[1]) - 1;
                    ^~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:88:10: note: '?' condition is false
           return ((sublinks & 1) ? sor[0] : sor[1]) - 1;
                   ^
   drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c:88:44: note: The left operand of '-' is a garbage value
           return ((sublinks & 1) ? sor[0] : sor[1]) - 1;
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   sound/pci/maestro3.c:1851:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(pcm->name, chip->card->driver);
           ^~~~~~
   sound/pci/maestro3.c:1851:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(pcm->name, chip->card->driver);
           ^~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   sound/pci/ac97/ac97_codec.c:1067:3: warning: Value stored to 'val' is never read [clang-analyzer-deadcode.DeadStores]
                   val = snd_ac97_read(ac97, reg);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/ac97/ac97_codec.c:1067:3: note: Value stored to 'val' is never read
                   val = snd_ac97_read(ac97, reg);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/ac97/ac97_codec.c:1104:3: warning: Value stored to 'val' is never read [clang-analyzer-deadcode.DeadStores]
                   val = snd_ac97_read(ac97, reg);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/ac97/ac97_codec.c:1104:3: note: Value stored to 'val' is never read
                   val = snd_ac97_read(ac97, reg);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/ac97/ac97_codec.c:1856:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(name, pid->name);
           ^~~~~~
   sound/pci/ac97/ac97_codec.c:1856:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(name, pid->name);
           ^~~~~~
   sound/pci/ac97/ac97_codec.c:1865:3: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcat(name, " ");

vim +/tmds_char_rate +1323 drivers/gpu/drm/vc4/vc4_hdmi.c

9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1295  
63495f6b4aede2 Maxime Ripard 2020-10-29  1296  static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
63495f6b4aede2 Maxime Ripard 2020-10-29  1297  					 struct drm_crtc_state *crtc_state,
63495f6b4aede2 Maxime Ripard 2020-10-29  1298  					 struct drm_connector_state *conn_state)
63495f6b4aede2 Maxime Ripard 2020-10-29  1299  {
f623746f74721b Maxime Ripard 2020-12-15  1300  	struct vc4_hdmi_connector_state *vc4_state = conn_state_to_vc4_hdmi_conn_state(conn_state);
63495f6b4aede2 Maxime Ripard 2020-10-29  1301  	struct drm_display_mode *mode = &crtc_state->adjusted_mode;
63495f6b4aede2 Maxime Ripard 2020-10-29  1302  	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
6135ee07702781 Maxime Ripard 2022-02-22  1303  	unsigned long long tmds_char_rate = mode->clock * 1000;
6135ee07702781 Maxime Ripard 2022-02-22  1304  	unsigned long long tmds_bit_rate;
595dcf4eb859d0 Maxime Ripard 2022-02-22  1305  	int ret;
63495f6b4aede2 Maxime Ripard 2020-10-29  1306  
57fb32e632be4d Maxime Ripard 2020-10-29  1307  	if (vc4_hdmi->variant->unsupported_odd_h_timings &&
57fb32e632be4d Maxime Ripard 2020-10-29  1308  	    ((mode->hdisplay % 2) || (mode->hsync_start % 2) ||
57fb32e632be4d Maxime Ripard 2020-10-29  1309  	     (mode->hsync_end % 2) || (mode->htotal % 2)))
57fb32e632be4d Maxime Ripard 2020-10-29  1310  		return -EINVAL;
57fb32e632be4d Maxime Ripard 2020-10-29  1311  
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1312  	/*
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1313  	 * The 1440p(a)60 pixel rate is in the same range than the first
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1314  	 * WiFi channel (between 2.4GHz and 2.422GHz with 22MHz
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1315  	 * bandwidth). Slightly lower the frequency to bring it out of
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1316  	 * the WiFi range.
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1317  	 */
6135ee07702781 Maxime Ripard 2022-02-22  1318  	tmds_bit_rate = tmds_char_rate * 10;
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1319  	if (vc4_hdmi->disable_wifi_frequencies &&
6135ee07702781 Maxime Ripard 2022-02-22  1320  	    (tmds_bit_rate >= WIFI_2_4GHz_CH1_MIN_FREQ &&
6135ee07702781 Maxime Ripard 2022-02-22  1321  	     tmds_bit_rate <= WIFI_2_4GHz_CH1_MAX_FREQ)) {
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1322  		mode->clock = 238560;
6135ee07702781 Maxime Ripard 2022-02-22 @1323  		tmds_char_rate = mode->clock * 1000;
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1324  	}
9fa1d7e60ad5ad Maxime Ripard 2020-10-29  1325  
595dcf4eb859d0 Maxime Ripard 2022-02-22  1326  	ret = vc4_hdmi_encoder_compute_clock(vc4_hdmi, vc4_state, mode,
595dcf4eb859d0 Maxime Ripard 2022-02-22  1327  					     conn_state->max_bpc);
595dcf4eb859d0 Maxime Ripard 2022-02-22  1328  	if (ret)
595dcf4eb859d0 Maxime Ripard 2022-02-22  1329  		return ret;
f623746f74721b Maxime Ripard 2020-12-15  1330  
63495f6b4aede2 Maxime Ripard 2020-10-29  1331  	return 0;
63495f6b4aede2 Maxime Ripard 2020-10-29  1332  }
63495f6b4aede2 Maxime Ripard 2020-10-29  1333  

:::::: The code at line 1323 was first introduced by commit
:::::: 6135ee07702781cd8206bcb1c202c4630d6e3c9c drm/vc4: hdmi: Rename pixel_rate variable

:::::: TO: Maxime Ripard <maxime@cerno.tech>
:::::: CC: Maxime Ripard <maxime@cerno.tech>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-01  6:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01  6:27 [kraxel:drm-misc-next 3/7] drivers/gpu/drm/vc4/vc4_hdmi.c:1323:3: warning: Value stored to 'tmds_char_rate' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot

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.