Skip to contentSkip to conversation

drivers//devfreq/devfreq.c:426:38: warning: variable 'freq' is uninitialized when used here

PATCH Nick Desaulniers 2 participants 2 messages Dec 20, 2019 – Dec 23, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 201912201959.QalWUTrz%[email protected]

#1 lore raw

Hi Chanwoo,
The below warning from a 0day bot build w/ Clang looks legit, can you please take a look?

Quoted 74 lines · kbuild test robot

CC: kbuild-all(a)lists.01.org
TO: Chanwoo Choi <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git devfreq-testing
head:   b5402cddb67cb59901cb74992831ef3015aed1a7
commit: b5402cddb67cb59901cb74992831ef3015aed1a7 [29/29] PM / devfreq: passive: Add missing getting freq_range
config: arm64-defconfig (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project 50c3bd9e71254d623ed4f0b449d5620f4e965bfe)

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout b5402cddb67cb59901cb74992831ef3015aed1a7
# save the attached .config to linux build tree
make.cross ARCH=arm64

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

   drivers//devfreq/devfreq.c:416:6: warning: unused variable 'flags' [-Wunused-variable]
           u32 flags = 0;
               ^
   drivers//devfreq/devfreq.c:415:6: warning: unused variable 'err' [-Wunused-variable]
           int err = 0;
               ^
   drivers//devfreq/devfreq.c:414:32: warning: unused variable 'max_freq' [-Wunused-variable]
           unsigned long freq, min_freq, max_freq;
                                         ^
   drivers//devfreq/devfreq.c:414:22: warning: unused variable 'min_freq' [-Wunused-variable]
           unsigned long freq, min_freq, max_freq;
                               ^
Quoted 1 line
Quoted 1 line

drivers//devfreq/devfreq.c:426:38: warning: variable 'freq' is uninitialized when used here [-Wuninitialized]

           return devfreq_update_freq(devfreq, freq);
                                               ^~~~
   drivers//devfreq/devfreq.c:414:20: note: initialize the variable 'freq' to silence this warning
           unsigned long freq, min_freq, max_freq;
                             ^
                              = 0

5 warnings generated.

vim +/freq +426 drivers//devfreq/devfreq.c

   404
   405  /**
   406   * update_devfreq() - Reevaluate the device and configure frequency.
   407   * @devfreq:    the devfreq instance.
   408   *
   409   * Note: Lock devfreq->lock before calling update_devfreq
   410   *       This function is exported for governors.
   411   */
   412  int update_devfreq(struct devfreq *devfreq)
   413  {
   414          unsigned long freq, min_freq, max_freq;
Quoted 1 line

415 int err = 0;

   416          u32 flags = 0;
   417
   418          if (!mutex_is_locked(&devfreq->lock)) {
   419                  WARN(true, "devfreq->lock must be locked by the caller.\n");
   420                  return -EINVAL;
   421          }
   422
   423          if (!devfreq->governor)
   424                  return -EINVAL;
   425
Quoted 1 line

426 return devfreq_update_freq(devfreq, freq);

427 }

   428  EXPORT_SYMBOL(update_devfreq);
   429

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw

Hi Nick,

Quoted 3 lines · Nick Desaulniers

Hi Chanwoo,
The below warning from a 0day bot build w/ Clang looks legit, can you please take a look?

Sorry for late behavior. I'll fix it.

Quoted 79 lines · kbuild test robot
Quoted 74 lines

CC: kbuild-all(a)lists.01.org
TO: Chanwoo Choi <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git devfreq-testing
head:   b5402cddb67cb59901cb74992831ef3015aed1a7
commit: b5402cddb67cb59901cb74992831ef3015aed1a7 [29/29] PM / devfreq: passive: Add missing getting freq_range
config: arm64-defconfig (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project 50c3bd9e71254d623ed4f0b449d5620f4e965bfe)

reproduce:
wget https://protect2.fireeye.com/url?k=573ddd83-0aee8697-573c56cc-0cc47a31ce4e-8f6c69829de1654d&u=https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout b5402cddb67cb59901cb74992831ef3015aed1a7
# save the attached .config to linux build tree
make.cross ARCH=arm64

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

   drivers//devfreq/devfreq.c:416:6: warning: unused variable 'flags' [-Wunused-variable]
           u32 flags = 0;
               ^
   drivers//devfreq/devfreq.c:415:6: warning: unused variable 'err' [-Wunused-variable]
           int err = 0;
               ^
   drivers//devfreq/devfreq.c:414:32: warning: unused variable 'max_freq' [-Wunused-variable]
           unsigned long freq, min_freq, max_freq;
                                         ^
   drivers//devfreq/devfreq.c:414:22: warning: unused variable 'min_freq' [-Wunused-variable]
           unsigned long freq, min_freq, max_freq;
                               ^
Quoted 1 line
Quoted 1 line

drivers//devfreq/devfreq.c:426:38: warning: variable 'freq' is uninitialized when used here [-Wuninitialized]

           return devfreq_update_freq(devfreq, freq);
                                               ^~~~
   drivers//devfreq/devfreq.c:414:20: note: initialize the variable 'freq' to silence this warning
           unsigned long freq, min_freq, max_freq;
                             ^
                              = 0

5 warnings generated.

vim +/freq +426 drivers//devfreq/devfreq.c

   404
   405  /**
   406   * update_devfreq() - Reevaluate the device and configure frequency.
   407   * @devfreq:    the devfreq instance.
   408   *
   409   * Note: Lock devfreq->lock before calling update_devfreq
   410   *       This function is exported for governors.
   411   */
   412  int update_devfreq(struct devfreq *devfreq)
   413  {
   414          unsigned long freq, min_freq, max_freq;
Quoted 1 line

415 int err = 0;

   416          u32 flags = 0;
   417
   418          if (!mutex_is_locked(&devfreq->lock)) {
   419                  WARN(true, "devfreq->lock must be locked by the caller.\n");
   420                  return -EINVAL;
   421          }
   422
   423          if (!devfreq->governor)
   424                  return -EINVAL;
   425
Quoted 1 line

426 return devfreq_update_freq(devfreq, freq);

427 }

   428  EXPORT_SYMBOL(update_devfreq);
   429

---
0-DAY kernel test infrastructure Open Source Technology Center
https://protect2.fireeye.com/url?k=ab89e7da-f65abcce-ab886c95-0cc47a31ce4e-8670feeedcf0eaab&u=https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics