From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Ben Skeggs <bskeggs@redhat.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org, Lyude Paul <lyude@redhat.com>
Subject: drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c:282 nvkm_chan_cctx_get() warn: inconsistent returns '&cgrp->mutex'.
Date: Thu, 29 Dec 2022 12:24:49 +0300 [thread overview]
Message-ID: <202212260844.AYAkoVok-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 72a85e2b0a1e1e6fb4ee51ae902730212b2de25c
commit: f48dd2936138882d7755cbbc5d9984015c75980c drm/nouveau/fifo: add new engine context tracking
config: s390-randconfig-m041-20221225
compiler: s390-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
smatch warnings:
drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c:282 nvkm_chan_cctx_get() warn: inconsistent returns '&cgrp->mutex'.
vim +282 drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c
f48dd293613888 Ben Skeggs 2022-06-01 241 int
f48dd293613888 Ben Skeggs 2022-06-01 242 nvkm_chan_cctx_get(struct nvkm_chan *chan, struct nvkm_engn *engn, struct nvkm_cctx **pcctx,
f48dd293613888 Ben Skeggs 2022-06-01 243 struct nvkm_client *client)
f48dd293613888 Ben Skeggs 2022-06-01 244 {
f48dd293613888 Ben Skeggs 2022-06-01 245 struct nvkm_cgrp *cgrp = chan->cgrp;
f48dd293613888 Ben Skeggs 2022-06-01 246 struct nvkm_vctx *vctx;
f48dd293613888 Ben Skeggs 2022-06-01 247 struct nvkm_cctx *cctx;
f48dd293613888 Ben Skeggs 2022-06-01 248 int ret;
f48dd293613888 Ben Skeggs 2022-06-01 249
f48dd293613888 Ben Skeggs 2022-06-01 250 /* Look for an existing channel context for this engine+VEID. */
f48dd293613888 Ben Skeggs 2022-06-01 251 mutex_lock(&cgrp->mutex);
f48dd293613888 Ben Skeggs 2022-06-01 252 cctx = nvkm_list_find(cctx, &chan->cctxs, head,
f48dd293613888 Ben Skeggs 2022-06-01 253 cctx->vctx->ectx->engn == engn && cctx->vctx->vmm == chan->vmm);
f48dd293613888 Ben Skeggs 2022-06-01 254 if (cctx) {
f48dd293613888 Ben Skeggs 2022-06-01 255 refcount_inc(&cctx->refs);
f48dd293613888 Ben Skeggs 2022-06-01 256 *pcctx = cctx;
f48dd293613888 Ben Skeggs 2022-06-01 257 mutex_unlock(&chan->cgrp->mutex);
This code is correct, but smatch wants people to use "&cgrp->mutex"
constistently instead of "&chan->cgrp->mutex".
f48dd293613888 Ben Skeggs 2022-06-01 258 return 0;
f48dd293613888 Ben Skeggs 2022-06-01 259 }
f48dd293613888 Ben Skeggs 2022-06-01 260
f48dd293613888 Ben Skeggs 2022-06-01 261 /* Nope - create a fresh one. But, sub-context first. */
f48dd293613888 Ben Skeggs 2022-06-01 262 ret = nvkm_cgrp_vctx_get(cgrp, engn, chan, &vctx, client);
f48dd293613888 Ben Skeggs 2022-06-01 263 if (ret) {
f48dd293613888 Ben Skeggs 2022-06-01 264 CHAN_ERROR(chan, "vctx %d[%s]: %d", engn->id, engn->engine->subdev.name, ret);
f48dd293613888 Ben Skeggs 2022-06-01 265 goto done;
f48dd293613888 Ben Skeggs 2022-06-01 266 }
f48dd293613888 Ben Skeggs 2022-06-01 267
f48dd293613888 Ben Skeggs 2022-06-01 268 /* Now, create the channel context - to track engine binding. */
f48dd293613888 Ben Skeggs 2022-06-01 269 CHAN_TRACE(chan, "ctor cctx %d[%s]", engn->id, engn->engine->subdev.name);
f48dd293613888 Ben Skeggs 2022-06-01 270 if (!(cctx = *pcctx = kzalloc(sizeof(*cctx), GFP_KERNEL))) {
f48dd293613888 Ben Skeggs 2022-06-01 271 nvkm_cgrp_vctx_put(cgrp, &vctx);
f48dd293613888 Ben Skeggs 2022-06-01 272 ret = -ENOMEM;
f48dd293613888 Ben Skeggs 2022-06-01 273 goto done;
f48dd293613888 Ben Skeggs 2022-06-01 274 }
f48dd293613888 Ben Skeggs 2022-06-01 275
f48dd293613888 Ben Skeggs 2022-06-01 276 cctx->vctx = vctx;
f48dd293613888 Ben Skeggs 2022-06-01 277 refcount_set(&cctx->refs, 1);
f48dd293613888 Ben Skeggs 2022-06-01 278 refcount_set(&cctx->uses, 0);
f48dd293613888 Ben Skeggs 2022-06-01 279 list_add_tail(&cctx->head, &chan->cctxs);
f48dd293613888 Ben Skeggs 2022-06-01 280 done:
f48dd293613888 Ben Skeggs 2022-06-01 281 mutex_unlock(&cgrp->mutex);
f48dd293613888 Ben Skeggs 2022-06-01 @282 return ret;
f48dd293613888 Ben Skeggs 2022-06-01 283 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
reply other threads:[~2022-12-29 9:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202212260844.AYAkoVok-lkp@intel.com \
--to=error27@gmail.com \
--cc=bskeggs@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=lyude@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox