drivers/gpu/drm/nouveau/nouveau_fence.c:210:45: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Wed Sep 13 2023 - 15:25:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3669558bdf354cd352be955ef2764cde6a9bf5ec
commit: 978474dc8278f661930e02e08d292a45a45fa01a drm/nouveau: fence: fix undefined fence state after emit
date: 2 weeks ago
config: i386-randconfig-062-20230913 (https://download.01.org/0day-ci/archive/20230914/202309140340.BwKXzaDx-lkp@xxxxxxxxx/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/202309140340.BwKXzaDx-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309140340.BwKXzaDx-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/nouveau_fence.c:210:45: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct nouveau_channel *chan @@ got struct nouveau_channel [noderef] __rcu *channel @@
drivers/gpu/drm/nouveau/nouveau_fence.c:210:45: sparse: expected struct nouveau_channel *chan
drivers/gpu/drm/nouveau/nouveau_fence.c:210:45: sparse: got struct nouveau_channel [noderef] __rcu *channel
drivers/gpu/drm/nouveau/nouveau_fence.c:418:24: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct nouveau_channel [noderef] __rcu *channel @@ got struct nouveau_channel *chan @@
drivers/gpu/drm/nouveau/nouveau_fence.c:418:24: sparse: expected struct nouveau_channel [noderef] __rcu *channel
drivers/gpu/drm/nouveau/nouveau_fence.c:418:24: sparse: got struct nouveau_channel *chan

vim +210 drivers/gpu/drm/nouveau/nouveau_fence.c

206
207 int
208 nouveau_fence_emit(struct nouveau_fence *fence)
209 {
> 210 struct nouveau_channel *chan = fence->channel;
211 struct nouveau_fence_chan *fctx = chan->fence;
212 struct nouveau_fence_priv *priv = (void*)chan->drm->fence;
213 int ret;
214
215 fence->timeout = jiffies + (15 * HZ);
216
217 if (priv->uevent)
218 dma_fence_init(&fence->base, &nouveau_fence_ops_uevent,
219 &fctx->lock, fctx->context, ++fctx->sequence);
220 else
221 dma_fence_init(&fence->base, &nouveau_fence_ops_legacy,
222 &fctx->lock, fctx->context, ++fctx->sequence);
223 kref_get(&fctx->fence_ref);
224
225 ret = fctx->emit(fence);
226 if (!ret) {
227 dma_fence_get(&fence->base);
228 spin_lock_irq(&fctx->lock);
229
230 if (unlikely(fctx->killed)) {
231 spin_unlock_irq(&fctx->lock);
232 dma_fence_put(&fence->base);
233 return -ENODEV;
234 }
235
236 if (nouveau_fence_update(chan, fctx))
237 nvif_event_block(&fctx->event);
238
239 list_add_tail(&fence->head, &fctx->pending);
240 spin_unlock_irq(&fctx->lock);
241 }
242
243 return ret;
244 }
245

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki