Re: [PATCH v3 2/2] i3c/master: introduce the mipi-i3c-hci driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nicolas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.10-rc3 next-20201110]
[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/Nicolas-Pitre/MIPI-I3c-HCI-Host-Controller-Interface-driver/20201103-062951
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: x86_64-randconfig-a015-20201110 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4d81c8adb6ed9840257f6cb6b93f60856d422a15)
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/22eb21b92e463c7030855ecf6dfd5d6f187249a1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicolas-Pitre/MIPI-I3c-HCI-Host-Controller-Interface-driver/20201103-062951
        git checkout 22eb21b92e463c7030855ecf6dfd5d6f187249a1
        # 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 <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/i3c/master/mipi-i3c-hci/cmd_v2.c:248:6: warning: variable 'next_addr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (!xfer)
               ^~~~~
   drivers/i3c/master/mipi-i3c-hci/cmd_v2.c:258:48: note: uninitialized use occurs here
                   ret = i3c_master_get_free_addr(&hci->master, next_addr);
                                                                ^~~~~~~~~
   drivers/i3c/master/mipi-i3c-hci/cmd_v2.c:248:2: note: remove the 'if' if its condition is always true
           if (!xfer)
           ^~~~~~~~~~
   drivers/i3c/master/mipi-i3c-hci/cmd_v2.c:243:14: note: initialize the variable 'next_addr' to silence this warning
           u8 next_addr;
                       ^
                        = '\0'
   1 warning generated.

vim +248 drivers/i3c/master/mipi-i3c-hci/cmd_v2.c

   238	
   239	static int hci_cmd_v2_daa(struct i3c_hci *hci)
   240	{
   241		struct hci_xfer *xfer;
   242		int ret;
   243		u8 next_addr;
   244		u32 device_id[2];
   245		DECLARE_COMPLETION_ONSTACK(done);
   246	
   247		xfer = hci_alloc_xfer(2);
 > 248		if (!xfer)
   249			return -ENOMEM;
   250	
   251		xfer[0].data = &device_id;
   252		xfer[0].data_len = 8;
   253		xfer[0].rnw = true;
   254		xfer[0].cmd_desc[1] = CMD_A1_DATA_LENGTH(8);
   255		xfer[1].completion = &done;
   256	
   257		for (;;) {
   258			ret = i3c_master_get_free_addr(&hci->master, next_addr);
   259			if (ret < 0)
   260				break;
   261			next_addr = ret;
   262			DBG("next_addr = 0x%02x", next_addr);
   263			xfer[0].cmd_tid = hci_get_tid();
   264			xfer[0].cmd_desc[0] =
   265				CMD_0_ATTR_A |
   266				CMD_A0_TID(xfer[0].cmd_tid) |
   267				CMD_A0_ROC;
   268			xfer[1].cmd_tid = hci_get_tid();
   269			xfer[1].cmd_desc[0] =
   270				CMD_0_ATTR_A |
   271				CMD_A0_TID(xfer[1].cmd_tid) |
   272				CMD_A0_ASSIGN_ADDRESS(next_addr) |
   273				CMD_A0_ROC |
   274				CMD_A0_TOC;
   275			hci->io->queue_xfer(hci, xfer, 2);
   276			if (!wait_for_completion_timeout(&done, HZ) &&
   277			    hci->io->dequeue_xfer(hci, xfer, 2)) {
   278				ret = -ETIME;
   279				break;
   280			}
   281			if (RESP_STATUS(xfer[0].response) != RESP_SUCCESS) {
   282				ret = 0;  /* no more devices to be assigned */
   283				break;
   284			}
   285			if (RESP_STATUS(xfer[1].response) != RESP_SUCCESS) {
   286				ret = -EIO;
   287				break;
   288			}
   289			DBG("assigned address %#x to device %08x %08x",
   290			    next_addr, device_id[0], device_id[1]);
   291			/*
   292			 * TODO: Extend the subsystem layer to allow for registering
   293			 * new device and provide BCR/DCR/PID at the same time.
   294			 */
   295			ret = i3c_master_add_i3c_dev_locked(&hci->master, next_addr);
   296			if (ret)
   297				break;
   298		}
   299	
   300		hci_free_xfer(xfer, 2);
   301		return ret;
   302	}
   303	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux