[asahilinux:pr/49 2/11] drivers/iommu/io-pgtable-dart.c:176:24: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Thu Sep 01 2022 - 16:21:08 EST


tree: https://github.com/AsahiLinux/linux pr/49
head: db5fe20b7f88a8443b0a3dd88bcfb35f1639624f
commit: d37982729eab5e80525ade0e5859409c284a8283 [2/11] iommu/io-pgtable: Move Apple DART support to its own file
config: alpha-randconfig-s042-20220901 (https://download.01.org/0day-ci/archive/20220902/202209020428.kbFTcWgT-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://github.com/AsahiLinux/linux/commit/d37982729eab5e80525ade0e5859409c284a8283
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux pr/49
git checkout d37982729eab5e80525ade0e5859409c284a8283
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/iommu/

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

sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/io-pgtable-dart.c:176:24: sparse: sparse: Using plain integer as NULL pointer

vim +176 drivers/iommu/io-pgtable-dart.c

161
162 static dart_iopte *dart_get_l2(struct dart_io_pgtable *data, unsigned long iova)
163 {
164 dart_iopte pte, *ptep;
165 int tbl = dart_get_table(data, iova);
166
167 ptep = data->pgd[tbl];
168 if (!ptep)
169 return NULL;
170
171 ptep += dart_get_l1_index(data, iova);
172 pte = READ_ONCE(*ptep);
173
174 /* Valid entry? */
175 if (!pte)
> 176 return 0;
177
178 /* Deref to get level 2 table */
179 return iopte_deref(pte, data);
180 }
181

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