drivers/gpu/drm/qxl/qxl_kms.c:277:21: sparse: sparse: incorrect type in argument 1 (different address spaces)
From: kernel test robot
Date: Tue Aug 18 2020 - 05:59:29 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 9 weeks ago
config: m68k-randconfig-s032-20200818 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.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.2-180-g49f7e13a-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k
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/gpu/drm/qxl/qxl_kms.c:36:5: sparse: sparse: symbol 'qxl_log_level' was not declared. Should it be static?
drivers/gpu/drm/qxl/qxl_kms.c:170:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qxl_rom *rom @@ got void [noderef] __iomem * @@
drivers/gpu/drm/qxl/qxl_kms.c:170:19: sparse: expected struct qxl_rom *rom
drivers/gpu/drm/qxl/qxl_kms.c:170:19: sparse: got void [noderef] __iomem *
drivers/gpu/drm/qxl/qxl_kms.c:188:26: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qxl_ram_header *ram_header @@ got void [noderef] __iomem * @@
drivers/gpu/drm/qxl/qxl_kms.c:188:26: sparse: expected struct qxl_ram_header *ram_header
drivers/gpu/drm/qxl/qxl_kms.c:188:26: sparse: got void [noderef] __iomem *
>> drivers/gpu/drm/qxl/qxl_kms.c:277:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got struct qxl_ram_header *ram_header @@
>> drivers/gpu/drm/qxl/qxl_kms.c:277:21: sparse: expected void [noderef] __iomem *addr
drivers/gpu/drm/qxl/qxl_kms.c:277:21: sparse: got struct qxl_ram_header *ram_header
>> drivers/gpu/drm/qxl/qxl_kms.c:281:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got struct qxl_rom *rom @@
drivers/gpu/drm/qxl/qxl_kms.c:281:21: sparse: expected void [noderef] __iomem *addr
drivers/gpu/drm/qxl/qxl_kms.c:281:21: sparse: got struct qxl_rom *rom
drivers/gpu/drm/qxl/qxl_kms.c:301:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got struct qxl_ram_header *ram_header @@
drivers/gpu/drm/qxl/qxl_kms.c:301:21: sparse: expected void [noderef] __iomem *addr
drivers/gpu/drm/qxl/qxl_kms.c:301:21: sparse: got struct qxl_ram_header *ram_header
drivers/gpu/drm/qxl/qxl_kms.c:302:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got struct qxl_rom *rom @@
drivers/gpu/drm/qxl/qxl_kms.c:302:21: sparse: expected void [noderef] __iomem *addr
drivers/gpu/drm/qxl/qxl_kms.c:302:21: sparse: got struct qxl_rom *rom
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=670d0a4b10704667765f7d18f7592993d02783aa
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
vim +277 drivers/gpu/drm/qxl/qxl_kms.c
f64122c1f6ade3 Dave Airlie 2013-02-25 109
2b65d5677a797f Gabriel Krisman Bertazi 2017-01-19 110 int qxl_device_init(struct qxl_device *qdev,
aa5b62bac05d4b Gabriel Krisman Bertazi 2017-02-27 111 struct pci_dev *pdev)
f64122c1f6ade3 Dave Airlie 2013-02-25 112 {
35541782dcc1e5 Gerd Hoffmann 2013-10-11 113 int r, sb;
f64122c1f6ade3 Dave Airlie 2013-02-25 114
cbdded7f8a633e Gabriel Krisman Bertazi 2017-01-26 115 qdev->ddev.pdev = pdev;
cbdded7f8a633e Gabriel Krisman Bertazi 2017-01-26 116 pci_set_drvdata(pdev, &qdev->ddev);
cbdded7f8a633e Gabriel Krisman Bertazi 2017-01-26 117
f64122c1f6ade3 Dave Airlie 2013-02-25 118 mutex_init(&qdev->gem.mutex);
f64122c1f6ade3 Dave Airlie 2013-02-25 119 mutex_init(&qdev->update_area_mutex);
f64122c1f6ade3 Dave Airlie 2013-02-25 120 mutex_init(&qdev->release_mutex);
f64122c1f6ade3 Dave Airlie 2013-02-25 121 mutex_init(&qdev->surf_evict_mutex);
b3740e88601d69 Christophe Fergeau 2016-11-08 122 qxl_gem_init(qdev);
f64122c1f6ade3 Dave Airlie 2013-02-25 123
f64122c1f6ade3 Dave Airlie 2013-02-25 124 qdev->rom_base = pci_resource_start(pdev, 2);
f64122c1f6ade3 Dave Airlie 2013-02-25 125 qdev->rom_size = pci_resource_len(pdev, 2);
f64122c1f6ade3 Dave Airlie 2013-02-25 126 qdev->vram_base = pci_resource_start(pdev, 0);
f64122c1f6ade3 Dave Airlie 2013-02-25 127 qdev->io_base = pci_resource_start(pdev, 3);
f64122c1f6ade3 Dave Airlie 2013-02-25 128
f64122c1f6ade3 Dave Airlie 2013-02-25 129 qdev->vram_mapping = io_mapping_create_wc(qdev->vram_base, pci_resource_len(pdev, 0));
5043348a4969ae Anton Vasilyev 2018-07-27 130 if (!qdev->vram_mapping) {
5043348a4969ae Anton Vasilyev 2018-07-27 131 pr_err("Unable to create vram_mapping");
a9b0b24a6fff2d Daniel Vetter 2020-04-15 132 return -ENOMEM;
5043348a4969ae Anton Vasilyev 2018-07-27 133 }
35541782dcc1e5 Gerd Hoffmann 2013-10-11 134
35541782dcc1e5 Gerd Hoffmann 2013-10-11 135 if (pci_resource_len(pdev, 4) > 0) {
35541782dcc1e5 Gerd Hoffmann 2013-10-11 136 /* 64bit surface bar present */
35541782dcc1e5 Gerd Hoffmann 2013-10-11 137 sb = 4;
35541782dcc1e5 Gerd Hoffmann 2013-10-11 138 qdev->surfaceram_base = pci_resource_start(pdev, sb);
35541782dcc1e5 Gerd Hoffmann 2013-10-11 139 qdev->surfaceram_size = pci_resource_len(pdev, sb);
35541782dcc1e5 Gerd Hoffmann 2013-10-11 140 qdev->surface_mapping =
35541782dcc1e5 Gerd Hoffmann 2013-10-11 141 io_mapping_create_wc(qdev->surfaceram_base,
35541782dcc1e5 Gerd Hoffmann 2013-10-11 142 qdev->surfaceram_size);
35541782dcc1e5 Gerd Hoffmann 2013-10-11 143 }
35541782dcc1e5 Gerd Hoffmann 2013-10-11 144 if (qdev->surface_mapping == NULL) {
35541782dcc1e5 Gerd Hoffmann 2013-10-11 145 /* 64bit surface bar not present (or mapping failed) */
35541782dcc1e5 Gerd Hoffmann 2013-10-11 146 sb = 1;
35541782dcc1e5 Gerd Hoffmann 2013-10-11 147 qdev->surfaceram_base = pci_resource_start(pdev, sb);
35541782dcc1e5 Gerd Hoffmann 2013-10-11 148 qdev->surfaceram_size = pci_resource_len(pdev, sb);
35541782dcc1e5 Gerd Hoffmann 2013-10-11 149 qdev->surface_mapping =
35541782dcc1e5 Gerd Hoffmann 2013-10-11 150 io_mapping_create_wc(qdev->surfaceram_base,
35541782dcc1e5 Gerd Hoffmann 2013-10-11 151 qdev->surfaceram_size);
5043348a4969ae Anton Vasilyev 2018-07-27 152 if (!qdev->surface_mapping) {
5043348a4969ae Anton Vasilyev 2018-07-27 153 pr_err("Unable to create surface_mapping");
5043348a4969ae Anton Vasilyev 2018-07-27 154 r = -ENOMEM;
5043348a4969ae Anton Vasilyev 2018-07-27 155 goto vram_mapping_free;
5043348a4969ae Anton Vasilyev 2018-07-27 156 }
35541782dcc1e5 Gerd Hoffmann 2013-10-11 157 }
35541782dcc1e5 Gerd Hoffmann 2013-10-11 158
35541782dcc1e5 Gerd Hoffmann 2013-10-11 159 DRM_DEBUG_KMS("qxl: vram %llx-%llx(%dM %dk), surface %llx-%llx(%dM %dk, %s)\n",
970fa986fadb11 Dave Airlie 2013-05-31 160 (unsigned long long)qdev->vram_base,
970fa986fadb11 Dave Airlie 2013-05-31 161 (unsigned long long)pci_resource_end(pdev, 0),
f64122c1f6ade3 Dave Airlie 2013-02-25 162 (int)pci_resource_len(pdev, 0) / 1024 / 1024,
f64122c1f6ade3 Dave Airlie 2013-02-25 163 (int)pci_resource_len(pdev, 0) / 1024,
970fa986fadb11 Dave Airlie 2013-05-31 164 (unsigned long long)qdev->surfaceram_base,
35541782dcc1e5 Gerd Hoffmann 2013-10-11 165 (unsigned long long)pci_resource_end(pdev, sb),
f64122c1f6ade3 Dave Airlie 2013-02-25 166 (int)qdev->surfaceram_size / 1024 / 1024,
35541782dcc1e5 Gerd Hoffmann 2013-10-11 167 (int)qdev->surfaceram_size / 1024,
35541782dcc1e5 Gerd Hoffmann 2013-10-11 168 (sb == 4) ? "64bit" : "32bit");
f64122c1f6ade3 Dave Airlie 2013-02-25 169
f64122c1f6ade3 Dave Airlie 2013-02-25 170 qdev->rom = ioremap(qdev->rom_base, qdev->rom_size);
f64122c1f6ade3 Dave Airlie 2013-02-25 171 if (!qdev->rom) {
f64122c1f6ade3 Dave Airlie 2013-02-25 172 pr_err("Unable to ioremap ROM\n");
5043348a4969ae Anton Vasilyev 2018-07-27 173 r = -ENOMEM;
5043348a4969ae Anton Vasilyev 2018-07-27 174 goto surface_mapping_free;
f64122c1f6ade3 Dave Airlie 2013-02-25 175 }
f64122c1f6ade3 Dave Airlie 2013-02-25 176
5043348a4969ae Anton Vasilyev 2018-07-27 177 if (!qxl_check_device(qdev)) {
5043348a4969ae Anton Vasilyev 2018-07-27 178 r = -ENODEV;
dbe3ad61dcebc4 Markus Elfring 2019-11-07 179 goto rom_unmap;
5043348a4969ae Anton Vasilyev 2018-07-27 180 }
f64122c1f6ade3 Dave Airlie 2013-02-25 181
f64122c1f6ade3 Dave Airlie 2013-02-25 182 r = qxl_bo_init(qdev);
f64122c1f6ade3 Dave Airlie 2013-02-25 183 if (r) {
f64122c1f6ade3 Dave Airlie 2013-02-25 184 DRM_ERROR("bo init failed %d\n", r);
5043348a4969ae Anton Vasilyev 2018-07-27 185 goto rom_unmap;
f64122c1f6ade3 Dave Airlie 2013-02-25 186 }
f64122c1f6ade3 Dave Airlie 2013-02-25 187
f64122c1f6ade3 Dave Airlie 2013-02-25 188 qdev->ram_header = ioremap(qdev->vram_base +
f64122c1f6ade3 Dave Airlie 2013-02-25 189 qdev->rom->ram_header_offset,
f64122c1f6ade3 Dave Airlie 2013-02-25 190 sizeof(*qdev->ram_header));
5043348a4969ae Anton Vasilyev 2018-07-27 191 if (!qdev->ram_header) {
5043348a4969ae Anton Vasilyev 2018-07-27 192 DRM_ERROR("Unable to ioremap RAM header\n");
5043348a4969ae Anton Vasilyev 2018-07-27 193 r = -ENOMEM;
5043348a4969ae Anton Vasilyev 2018-07-27 194 goto bo_fini;
5043348a4969ae Anton Vasilyev 2018-07-27 195 }
f64122c1f6ade3 Dave Airlie 2013-02-25 196
f64122c1f6ade3 Dave Airlie 2013-02-25 197 qdev->command_ring = qxl_ring_create(&(qdev->ram_header->cmd_ring_hdr),
f64122c1f6ade3 Dave Airlie 2013-02-25 198 sizeof(struct qxl_command),
f64122c1f6ade3 Dave Airlie 2013-02-25 199 QXL_COMMAND_RING_SIZE,
f64122c1f6ade3 Dave Airlie 2013-02-25 200 qdev->io_base + QXL_IO_NOTIFY_CMD,
f64122c1f6ade3 Dave Airlie 2013-02-25 201 false,
f64122c1f6ade3 Dave Airlie 2013-02-25 202 &qdev->display_event);
5043348a4969ae Anton Vasilyev 2018-07-27 203 if (!qdev->command_ring) {
5043348a4969ae Anton Vasilyev 2018-07-27 204 DRM_ERROR("Unable to create command ring\n");
5043348a4969ae Anton Vasilyev 2018-07-27 205 r = -ENOMEM;
5043348a4969ae Anton Vasilyev 2018-07-27 206 goto ram_header_unmap;
5043348a4969ae Anton Vasilyev 2018-07-27 207 }
f64122c1f6ade3 Dave Airlie 2013-02-25 208
f64122c1f6ade3 Dave Airlie 2013-02-25 209 qdev->cursor_ring = qxl_ring_create(
f64122c1f6ade3 Dave Airlie 2013-02-25 210 &(qdev->ram_header->cursor_ring_hdr),
f64122c1f6ade3 Dave Airlie 2013-02-25 211 sizeof(struct qxl_command),
f64122c1f6ade3 Dave Airlie 2013-02-25 212 QXL_CURSOR_RING_SIZE,
80e5f89da3ab94 Huacai Chen 2020-03-31 213 qdev->io_base + QXL_IO_NOTIFY_CURSOR,
f64122c1f6ade3 Dave Airlie 2013-02-25 214 false,
f64122c1f6ade3 Dave Airlie 2013-02-25 215 &qdev->cursor_event);
f64122c1f6ade3 Dave Airlie 2013-02-25 216
5043348a4969ae Anton Vasilyev 2018-07-27 217 if (!qdev->cursor_ring) {
5043348a4969ae Anton Vasilyev 2018-07-27 218 DRM_ERROR("Unable to create cursor ring\n");
5043348a4969ae Anton Vasilyev 2018-07-27 219 r = -ENOMEM;
5043348a4969ae Anton Vasilyev 2018-07-27 220 goto command_ring_free;
5043348a4969ae Anton Vasilyev 2018-07-27 221 }
5043348a4969ae Anton Vasilyev 2018-07-27 222
f64122c1f6ade3 Dave Airlie 2013-02-25 223 qdev->release_ring = qxl_ring_create(
f64122c1f6ade3 Dave Airlie 2013-02-25 224 &(qdev->ram_header->release_ring_hdr),
f64122c1f6ade3 Dave Airlie 2013-02-25 225 sizeof(uint64_t),
f64122c1f6ade3 Dave Airlie 2013-02-25 226 QXL_RELEASE_RING_SIZE, 0, true,
f64122c1f6ade3 Dave Airlie 2013-02-25 227 NULL);
f64122c1f6ade3 Dave Airlie 2013-02-25 228
5043348a4969ae Anton Vasilyev 2018-07-27 229 if (!qdev->release_ring) {
5043348a4969ae Anton Vasilyev 2018-07-27 230 DRM_ERROR("Unable to create release ring\n");
5043348a4969ae Anton Vasilyev 2018-07-27 231 r = -ENOMEM;
5043348a4969ae Anton Vasilyev 2018-07-27 232 goto cursor_ring_free;
5043348a4969ae Anton Vasilyev 2018-07-27 233 }
f64122c1f6ade3 Dave Airlie 2013-02-25 234
f64122c1f6ade3 Dave Airlie 2013-02-25 235 idr_init(&qdev->release_idr);
f64122c1f6ade3 Dave Airlie 2013-02-25 236 spin_lock_init(&qdev->release_idr_lock);
2f453ed4038526 Maarten Lankhorst 2014-04-02 237 spin_lock_init(&qdev->release_lock);
f64122c1f6ade3 Dave Airlie 2013-02-25 238
f64122c1f6ade3 Dave Airlie 2013-02-25 239 idr_init(&qdev->surf_id_idr);
f64122c1f6ade3 Dave Airlie 2013-02-25 240 spin_lock_init(&qdev->surf_id_idr_lock);
f64122c1f6ade3 Dave Airlie 2013-02-25 241
f64122c1f6ade3 Dave Airlie 2013-02-25 242 mutex_init(&qdev->async_io_mutex);
f64122c1f6ade3 Dave Airlie 2013-02-25 243
f64122c1f6ade3 Dave Airlie 2013-02-25 244 /* reset the device into a known state - no memslots, no primary
f64122c1f6ade3 Dave Airlie 2013-02-25 245 * created, no surfaces. */
f64122c1f6ade3 Dave Airlie 2013-02-25 246 qxl_io_reset(qdev);
f64122c1f6ade3 Dave Airlie 2013-02-25 247
f64122c1f6ade3 Dave Airlie 2013-02-25 248 /* must initialize irq before first async io - slot creation */
f64122c1f6ade3 Dave Airlie 2013-02-25 249 r = qxl_irq_init(qdev);
5043348a4969ae Anton Vasilyev 2018-07-27 250 if (r) {
5043348a4969ae Anton Vasilyev 2018-07-27 251 DRM_ERROR("Unable to init qxl irq\n");
2ec6bd67b76ea0 Gerd Hoffmann 2019-01-18 252 goto release_ring_free;
5043348a4969ae Anton Vasilyev 2018-07-27 253 }
f64122c1f6ade3 Dave Airlie 2013-02-25 254
f64122c1f6ade3 Dave Airlie 2013-02-25 255 /*
f64122c1f6ade3 Dave Airlie 2013-02-25 256 * Note that virtual is surface0. We rely on the single ioremap done
f64122c1f6ade3 Dave Airlie 2013-02-25 257 * before.
f64122c1f6ade3 Dave Airlie 2013-02-25 258 */
2ec6bd67b76ea0 Gerd Hoffmann 2019-01-18 259 setup_slot(qdev, &qdev->main_slot, 0, "main",
f64122c1f6ade3 Dave Airlie 2013-02-25 260 (unsigned long)qdev->vram_base,
2ec6bd67b76ea0 Gerd Hoffmann 2019-01-18 261 (unsigned long)qdev->rom->ram_header_offset);
2ec6bd67b76ea0 Gerd Hoffmann 2019-01-18 262 setup_slot(qdev, &qdev->surfaces_slot, 1, "surfaces",
d9bbf1895f354c Gerd Hoffmann 2013-10-11 263 (unsigned long)qdev->surfaceram_base,
d9bbf1895f354c Gerd Hoffmann 2013-10-11 264 (unsigned long)qdev->surfaceram_size);
f64122c1f6ade3 Dave Airlie 2013-02-25 265
f64122c1f6ade3 Dave Airlie 2013-02-25 266 INIT_WORK(&qdev->gc_work, qxl_gc_work);
f64122c1f6ade3 Dave Airlie 2013-02-25 267
f64122c1f6ade3 Dave Airlie 2013-02-25 268 return 0;
5043348a4969ae Anton Vasilyev 2018-07-27 269
5043348a4969ae Anton Vasilyev 2018-07-27 270 release_ring_free:
5043348a4969ae Anton Vasilyev 2018-07-27 271 qxl_ring_free(qdev->release_ring);
5043348a4969ae Anton Vasilyev 2018-07-27 272 cursor_ring_free:
5043348a4969ae Anton Vasilyev 2018-07-27 273 qxl_ring_free(qdev->cursor_ring);
5043348a4969ae Anton Vasilyev 2018-07-27 274 command_ring_free:
5043348a4969ae Anton Vasilyev 2018-07-27 275 qxl_ring_free(qdev->command_ring);
5043348a4969ae Anton Vasilyev 2018-07-27 276 ram_header_unmap:
5043348a4969ae Anton Vasilyev 2018-07-27 @277 iounmap(qdev->ram_header);
5043348a4969ae Anton Vasilyev 2018-07-27 278 bo_fini:
5043348a4969ae Anton Vasilyev 2018-07-27 279 qxl_bo_fini(qdev);
5043348a4969ae Anton Vasilyev 2018-07-27 280 rom_unmap:
5043348a4969ae Anton Vasilyev 2018-07-27 @281 iounmap(qdev->rom);
5043348a4969ae Anton Vasilyev 2018-07-27 282 surface_mapping_free:
5043348a4969ae Anton Vasilyev 2018-07-27 283 io_mapping_free(qdev->surface_mapping);
5043348a4969ae Anton Vasilyev 2018-07-27 284 vram_mapping_free:
5043348a4969ae Anton Vasilyev 2018-07-27 285 io_mapping_free(qdev->vram_mapping);
5043348a4969ae Anton Vasilyev 2018-07-27 286 return r;
f64122c1f6ade3 Dave Airlie 2013-02-25 287 }
f64122c1f6ade3 Dave Airlie 2013-02-25 288
:::::: The code at line 277 was first introduced by commit
:::::: 5043348a4969ae1661c008efe929abd0d76e3792 drm: qxl: Fix error handling at qxl_device_init
:::::: TO: Anton Vasilyev <vasilyev@xxxxxxxxx>
:::::: CC: Gerd Hoffmann <kraxel@xxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip