[linux-next:master 9639/11353] drivers/vfio/pci/mlx5/main.c:409:24: sparse: sparse: Using plain integer as NULL pointer

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   cb153b68ff91cbc434f3de70ac549e110543e1bb
commit: 6fadb021266d03c5fd7bca2cfa1607efd246dad1 [9639/11353] vfio/mlx5: Implement vfio_pci driver for mlx5 devices
config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20220309/202203090703.kxvZumJg-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=6fadb021266d03c5fd7bca2cfa1607efd246dad1
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 6fadb021266d03c5fd7bca2cfa1607efd246dad1
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/vfio/pci/mlx5/

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


sparse warnings: (new ones prefixed by >>)
>> drivers/vfio/pci/mlx5/main.c:409:24: sparse: sparse: Using plain integer as NULL pointer
   drivers/vfio/pci/mlx5/main.c:430:24: sparse: sparse: Using plain integer as NULL pointer

vim +409 drivers/vfio/pci/mlx5/main.c

   352	
   353	static struct file *
   354	mlx5vf_pci_step_device_state_locked(struct mlx5vf_pci_core_device *mvdev,
   355					    u32 new)
   356	{
   357		u32 cur = mvdev->mig_state;
   358		int ret;
   359	
   360		if (cur == VFIO_DEVICE_STATE_RUNNING_P2P && new == VFIO_DEVICE_STATE_STOP) {
   361			ret = mlx5vf_cmd_suspend_vhca(
   362				mvdev->core_device.pdev, mvdev->vhca_id,
   363				MLX5_SUSPEND_VHCA_IN_OP_MOD_SUSPEND_RESPONDER);
   364			if (ret)
   365				return ERR_PTR(ret);
   366			return NULL;
   367		}
   368	
   369		if (cur == VFIO_DEVICE_STATE_STOP && new == VFIO_DEVICE_STATE_RUNNING_P2P) {
   370			ret = mlx5vf_cmd_resume_vhca(
   371				mvdev->core_device.pdev, mvdev->vhca_id,
   372				MLX5_RESUME_VHCA_IN_OP_MOD_RESUME_RESPONDER);
   373			if (ret)
   374				return ERR_PTR(ret);
   375			return NULL;
   376		}
   377	
   378		if (cur == VFIO_DEVICE_STATE_RUNNING && new == VFIO_DEVICE_STATE_RUNNING_P2P) {
   379			ret = mlx5vf_cmd_suspend_vhca(
   380				mvdev->core_device.pdev, mvdev->vhca_id,
   381				MLX5_SUSPEND_VHCA_IN_OP_MOD_SUSPEND_INITIATOR);
   382			if (ret)
   383				return ERR_PTR(ret);
   384			return NULL;
   385		}
   386	
   387		if (cur == VFIO_DEVICE_STATE_RUNNING_P2P && new == VFIO_DEVICE_STATE_RUNNING) {
   388			ret = mlx5vf_cmd_resume_vhca(
   389				mvdev->core_device.pdev, mvdev->vhca_id,
   390				MLX5_RESUME_VHCA_IN_OP_MOD_RESUME_INITIATOR);
   391			if (ret)
   392				return ERR_PTR(ret);
   393			return NULL;
   394		}
   395	
   396		if (cur == VFIO_DEVICE_STATE_STOP && new == VFIO_DEVICE_STATE_STOP_COPY) {
   397			struct mlx5_vf_migration_file *migf;
   398	
   399			migf = mlx5vf_pci_save_device_data(mvdev);
   400			if (IS_ERR(migf))
   401				return ERR_CAST(migf);
   402			get_file(migf->filp);
   403			mvdev->saving_migf = migf;
   404			return migf->filp;
   405		}
   406	
   407		if ((cur == VFIO_DEVICE_STATE_STOP_COPY && new == VFIO_DEVICE_STATE_STOP)) {
   408			mlx5vf_disable_fds(mvdev);
 > 409			return 0;
   410		}
   411	
   412		if (cur == VFIO_DEVICE_STATE_STOP && new == VFIO_DEVICE_STATE_RESUMING) {
   413			struct mlx5_vf_migration_file *migf;
   414	
   415			migf = mlx5vf_pci_resume_device_data(mvdev);
   416			if (IS_ERR(migf))
   417				return ERR_CAST(migf);
   418			get_file(migf->filp);
   419			mvdev->resuming_migf = migf;
   420			return migf->filp;
   421		}
   422	
   423		if (cur == VFIO_DEVICE_STATE_RESUMING && new == VFIO_DEVICE_STATE_STOP) {
   424			ret = mlx5vf_cmd_load_vhca_state(mvdev->core_device.pdev,
   425							 mvdev->vhca_id,
   426							 mvdev->resuming_migf);
   427			if (ret)
   428				return ERR_PTR(ret);
   429			mlx5vf_disable_fds(mvdev);
   430			return 0;
   431		}
   432	
   433		/*
   434		 * vfio_mig_get_next_state() does not use arcs other than the above
   435		 */
   436		WARN_ON(true);
   437		return ERR_PTR(-EINVAL);
   438	}
   439	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux