Hi Jaegeuk,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master linux/master 
v5.10-rc1 next-20201027]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/Jaegeuk-Kim/scsi-ufs-atomic-update-for-clkgating_enable/20201025-000720
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-a012-20201027 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
f2c25c70791de95d2466e09b5b58fc37f6ccd7a4)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # 
https://github.com/0day-ci/linux/commit/48327c0914e146090df19aaa6df3f0ed569d9669
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Jaegeuk-Kim/scsi-ufs-atomic-update-for-clkgating_enable/20201025-000720
        git checkout 48327c0914e146090df19aaa6df3f0ed569d9669
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/scsi/ufs/ufshcd.c:7618:3: warning: variable 'sdp' is used 
>> uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   BUG_ON(1);
                   ^~~~~~~~~
   include/asm-generic/bug.h:63:32: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                  ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/ufs/ufshcd.c:7619:6: note: uninitialized use occurs here
           if (sdp) {
               ^~~
   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/scsi/ufs/ufshcd.c:7618:3: note: remove the 'if' if its condition is 
always true
                   BUG_ON(1);
                   ^
   include/asm-generic/bug.h:63:32: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                  ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/scsi/ufs/ufshcd.c:7608:25: note: initialize the variable 'sdp' to 
silence this warning
           struct scsi_device *sdp;
                                  ^
                                   = NULL
   1 warning generated.

vim +7618 drivers/scsi/ufs/ufshcd.c

  7605  
  7606  static int ufshcd_clear_ua_wlun(struct ufs_hba *hba, u8 wlun)
  7607  {
  7608          struct scsi_device *sdp;
  7609          unsigned long flags;
  7610          int ret = 0;
  7611  
  7612          spin_lock_irqsave(hba->host->host_lock, flags);
  7613          if (wlun  == UFS_UPIU_UFS_DEVICE_WLUN)
  7614                  sdp = hba->sdev_ufs_device;
  7615          else if (wlun  == UFS_UPIU_RPMB_WLUN)
  7616                  sdp = hba->sdev_rpmb;
  7617          else
> 7618                  BUG_ON(1);
  7619          if (sdp) {
  7620                  ret = scsi_device_get(sdp);
  7621                  if (!ret && !scsi_device_online(sdp)) {
  7622                          ret = -ENODEV;
  7623                          scsi_device_put(sdp);
  7624                  }
  7625          } else {
  7626                  ret = -ENODEV;
  7627          }
  7628          spin_unlock_irqrestore(hba->host->host_lock, flags);
  7629          if (ret)
  7630                  goto out_err;
  7631  
  7632          ret = ufshcd_send_request_sense(hba, sdp);
  7633          scsi_device_put(sdp);
  7634  out_err:
  7635          if (ret)
  7636                  dev_err(hba->dev, "%s: UAC clear LU=%x ret = %d\n",
  7637                                  __func__, wlun, ret);
  7638          return ret;
  7639  }
  7640  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to