From: kernel test robot <lkp@intel.com>
To: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: [pinchartl:rpi/v6.5/unicam/dev 5/20] drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c:548:8: warning: variable 'ret' is used uninitialized whenever 'if' condition is false
Date: Sun, 3 Sep 2023 07:27:50 +0800 [thread overview]
Message-ID: <202309030713.kOdUicZM-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git rpi/v6.5/unicam/dev
head: 3f609d0d03e4967469b2aa22738b1bae74cff2b0
commit: d58f9a24df342493c1b8bf3064a6be03ad7d4de1 [5/20] media: v4l: Add V4L2-PIX-FMT-Y14P format
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20230903/202309030713.kOdUicZM-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230903/202309030713.kOdUicZM-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309030713.kOdUicZM-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c:548:8: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (IS_ERR(buf->mmal.dma_buf)) {
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c:563:9: note: uninitialized use occurs here
return ret;
^~~
drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c:548:4: note: remove the 'if' if its condition is always true
if (IS_ERR(buf->mmal.dma_buf)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c:483:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c:160:20: warning: unused function 'node_is_capture' [-Wunused-function]
static inline bool node_is_capture(struct bcm2835_isp_node *node)
^
2 warnings generated.
vim +548 drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
11c7ef536f621f Naushir Patuck 2020-04-23 474
11c7ef536f621f Naushir Patuck 2020-04-23 475 static int bcm2835_isp_buf_prepare(struct vb2_buffer *vb)
11c7ef536f621f Naushir Patuck 2020-04-23 476 {
11c7ef536f621f Naushir Patuck 2020-04-23 477 struct bcm2835_isp_node *node = vb2_get_drv_priv(vb->vb2_queue);
11c7ef536f621f Naushir Patuck 2020-04-23 478 struct bcm2835_isp_dev *dev = node_get_dev(node);
11c7ef536f621f Naushir Patuck 2020-04-23 479 struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb);
11c7ef536f621f Naushir Patuck 2020-04-23 480 struct bcm2835_isp_buffer *buf =
11c7ef536f621f Naushir Patuck 2020-04-23 481 container_of(vb2, struct bcm2835_isp_buffer, vb);
11c7ef536f621f Naushir Patuck 2020-04-23 482 struct dma_buf *dma_buf;
11c7ef536f621f Naushir Patuck 2020-04-23 483 int ret;
11c7ef536f621f Naushir Patuck 2020-04-23 484
11c7ef536f621f Naushir Patuck 2020-04-23 485 v4l2_dbg(3, debug, &dev->v4l2_dev, "%s: type: %d ptr %p\n",
11c7ef536f621f Naushir Patuck 2020-04-23 486 __func__, vb->vb2_queue->type, vb);
11c7ef536f621f Naushir Patuck 2020-04-23 487
11c7ef536f621f Naushir Patuck 2020-04-23 488 if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) {
11c7ef536f621f Naushir Patuck 2020-04-23 489 if (vb2->field == V4L2_FIELD_ANY)
11c7ef536f621f Naushir Patuck 2020-04-23 490 vb2->field = V4L2_FIELD_NONE;
11c7ef536f621f Naushir Patuck 2020-04-23 491 if (vb2->field != V4L2_FIELD_NONE) {
11c7ef536f621f Naushir Patuck 2020-04-23 492 v4l2_err(&dev->v4l2_dev,
11c7ef536f621f Naushir Patuck 2020-04-23 493 "%s field isn't supported\n", __func__);
11c7ef536f621f Naushir Patuck 2020-04-23 494 return -EINVAL;
11c7ef536f621f Naushir Patuck 2020-04-23 495 }
11c7ef536f621f Naushir Patuck 2020-04-23 496 }
11c7ef536f621f Naushir Patuck 2020-04-23 497
11c7ef536f621f Naushir Patuck 2020-04-23 498 if (vb2_plane_size(vb, 0) < node->q_data.sizeimage) {
11c7ef536f621f Naushir Patuck 2020-04-23 499 v4l2_err(&dev->v4l2_dev,
11c7ef536f621f Naushir Patuck 2020-04-23 500 "%s data will not fit into plane (%lu < %lu)\n",
11c7ef536f621f Naushir Patuck 2020-04-23 501 __func__, vb2_plane_size(vb, 0),
11c7ef536f621f Naushir Patuck 2020-04-23 502 (long)node->q_data.sizeimage);
11c7ef536f621f Naushir Patuck 2020-04-23 503 return -EINVAL;
11c7ef536f621f Naushir Patuck 2020-04-23 504 }
11c7ef536f621f Naushir Patuck 2020-04-23 505
11c7ef536f621f Naushir Patuck 2020-04-23 506 if (!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type))
11c7ef536f621f Naushir Patuck 2020-04-23 507 vb2_set_plane_payload(vb, 0, node->q_data.sizeimage);
11c7ef536f621f Naushir Patuck 2020-04-23 508
11c7ef536f621f Naushir Patuck 2020-04-23 509 switch (vb->memory) {
11c7ef536f621f Naushir Patuck 2020-04-23 510 case VB2_MEMORY_DMABUF:
11c7ef536f621f Naushir Patuck 2020-04-23 511 dma_buf = dma_buf_get(vb->planes[0].m.fd);
11c7ef536f621f Naushir Patuck 2020-04-23 512
11c7ef536f621f Naushir Patuck 2020-04-23 513 if (dma_buf != buf->mmal.dma_buf) {
11c7ef536f621f Naushir Patuck 2020-04-23 514 /*
11c7ef536f621f Naushir Patuck 2020-04-23 515 * dmabuf either hasn't already been mapped, or it has
11c7ef536f621f Naushir Patuck 2020-04-23 516 * changed.
11c7ef536f621f Naushir Patuck 2020-04-23 517 */
11c7ef536f621f Naushir Patuck 2020-04-23 518 if (buf->mmal.dma_buf) {
11c7ef536f621f Naushir Patuck 2020-04-23 519 v4l2_err(&dev->v4l2_dev,
11c7ef536f621f Naushir Patuck 2020-04-23 520 "%s Buffer changed - why did the core not call cleanup?\n",
11c7ef536f621f Naushir Patuck 2020-04-23 521 __func__);
11c7ef536f621f Naushir Patuck 2020-04-23 522 bcm2835_isp_mmal_buf_cleanup(&buf->mmal);
11c7ef536f621f Naushir Patuck 2020-04-23 523 }
11c7ef536f621f Naushir Patuck 2020-04-23 524
11c7ef536f621f Naushir Patuck 2020-04-23 525 buf->mmal.dma_buf = dma_buf;
11c7ef536f621f Naushir Patuck 2020-04-23 526 } else {
11c7ef536f621f Naushir Patuck 2020-04-23 527 /*
11c7ef536f621f Naushir Patuck 2020-04-23 528 * Already have a reference to the buffer, so release it
11c7ef536f621f Naushir Patuck 2020-04-23 529 * here.
11c7ef536f621f Naushir Patuck 2020-04-23 530 */
11c7ef536f621f Naushir Patuck 2020-04-23 531 dma_buf_put(dma_buf);
11c7ef536f621f Naushir Patuck 2020-04-23 532 }
11c7ef536f621f Naushir Patuck 2020-04-23 533 ret = 0;
11c7ef536f621f Naushir Patuck 2020-04-23 534 break;
11c7ef536f621f Naushir Patuck 2020-04-23 535 case VB2_MEMORY_MMAP:
11c7ef536f621f Naushir Patuck 2020-04-23 536 /*
11c7ef536f621f Naushir Patuck 2020-04-23 537 * We want to do this at init, but vb2_core_expbuf checks that
11c7ef536f621f Naushir Patuck 2020-04-23 538 * the index < q->num_buffers, and q->num_buffers only gets
11c7ef536f621f Naushir Patuck 2020-04-23 539 * updated once all the buffers are allocated.
11c7ef536f621f Naushir Patuck 2020-04-23 540 */
11c7ef536f621f Naushir Patuck 2020-04-23 541 if (!buf->mmal.dma_buf) {
11c7ef536f621f Naushir Patuck 2020-04-23 542 buf->mmal.dma_buf = vb2_core_expbuf_dmabuf(vb->vb2_queue,
11c7ef536f621f Naushir Patuck 2020-04-23 543 vb->vb2_queue->type,
11c7ef536f621f Naushir Patuck 2020-04-23 544 vb->index, 0, O_CLOEXEC);
11c7ef536f621f Naushir Patuck 2020-04-23 545 v4l2_dbg(3, debug, &dev->v4l2_dev,
11c7ef536f621f Naushir Patuck 2020-04-23 546 "%s: exporting ptr %p to dmabuf %p\n",
11c7ef536f621f Naushir Patuck 2020-04-23 547 __func__, vb, buf->mmal.dma_buf);
11c7ef536f621f Naushir Patuck 2020-04-23 @548 if (IS_ERR(buf->mmal.dma_buf)) {
11c7ef536f621f Naushir Patuck 2020-04-23 549 ret = PTR_ERR(buf->mmal.dma_buf);
11c7ef536f621f Naushir Patuck 2020-04-23 550 v4l2_err(&dev->v4l2_dev,
11c7ef536f621f Naushir Patuck 2020-04-23 551 "%s: Failed to expbuf idx %d, ret %d\n",
11c7ef536f621f Naushir Patuck 2020-04-23 552 __func__, vb->index, ret);
11c7ef536f621f Naushir Patuck 2020-04-23 553 }
11c7ef536f621f Naushir Patuck 2020-04-23 554 } else {
11c7ef536f621f Naushir Patuck 2020-04-23 555 ret = 0;
11c7ef536f621f Naushir Patuck 2020-04-23 556 }
11c7ef536f621f Naushir Patuck 2020-04-23 557 break;
11c7ef536f621f Naushir Patuck 2020-04-23 558 default:
11c7ef536f621f Naushir Patuck 2020-04-23 559 ret = -EINVAL;
11c7ef536f621f Naushir Patuck 2020-04-23 560 break;
11c7ef536f621f Naushir Patuck 2020-04-23 561 }
11c7ef536f621f Naushir Patuck 2020-04-23 562
11c7ef536f621f Naushir Patuck 2020-04-23 563 return ret;
11c7ef536f621f Naushir Patuck 2020-04-23 564 }
11c7ef536f621f Naushir Patuck 2020-04-23 565
:::::: The code at line 548 was first introduced by commit
:::::: 11c7ef536f621f0e16903697c4785f7eee84f6d8 staging: vc04_services: bcm2835-isp: Add a more complex ISP processing component
:::::: TO: Naushir Patuck <naush@raspberrypi.com>
:::::: CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-09-02 23:28 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=202309030713.kOdUicZM-lkp@intel.com \
--to=lkp@intel.com \
--cc=jeanmichel.hautbois@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.