linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org,
	Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Andy Gross <agross@kernel.org>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-msm@vger.kernel.org, arnaud.pouliquen@foss.st.com
Subject: Re: [PATCH v2 13/16] rpmsg: virtio: probe the rpmsg_ctl device
Date: Mon, 4 Jan 2021 15:59:51 +0300	[thread overview]
Message-ID: <20210104125950.GP2809@kadam> (raw)
In-Reply-To: <20201222105726.16906-14-arnaud.pouliquen@foss.st.com>

[-- Attachment #1: Type: text/plain, Size: 12624 bytes --]

Hi Arnaud,

url:    https://github.com/0day-ci/linux/commits/Arnaud-Pouliquen/introduce-generic-IOCTL-interface-for-RPMsg-channels-management/20201222-190521
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8653b778e454a7708847aeafe689bce07aeeb94e
config: x86_64-randconfig-m001-20201221 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/rpmsg/virtio_rpmsg_bus.c:978 rpmsg_probe() error: uninitialized symbol 'vch'.
drivers/rpmsg/virtio_rpmsg_bus.c:979 rpmsg_probe() error: uninitialized symbol 'rpdev_ctrl'.

vim +/vch +978 drivers/rpmsg/virtio_rpmsg_bus.c

bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  846  static int rpmsg_probe(struct virtio_device *vdev)
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  847  {
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  848  	vq_callback_t *vq_cbs[] = { rpmsg_recv_done, rpmsg_xmit_done };
f7ad26ff952b3ca Stefan Hajnoczi      2015-12-17  849  	static const char * const names[] = { "input", "output" };
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  850  	struct virtqueue *vqs[2];
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  851  	struct virtproc_info *vrp;
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  852  	struct virtio_rpmsg_channel *vch;
                                                                                     ^^^
532ff49403675dd Arnaud Pouliquen     2020-12-22  853  	struct rpmsg_device *rpdev_ns, *rpdev_ctrl;
                                                                                        ^^^^^^^^^^

bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  854  	void *bufs_va;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  855  	int err = 0, i;
b1b9891441fa33f Suman Anna           2014-09-16  856  	size_t total_buf_space;
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  857  	bool notify;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  858  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  859  	vrp = kzalloc(sizeof(*vrp), GFP_KERNEL);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  860  	if (!vrp)
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  861  		return -ENOMEM;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  862  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  863  	vrp->vdev = vdev;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  864  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  865  	idr_init(&vrp->endpoints);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  866  	mutex_init(&vrp->endpoints_lock);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  867  	mutex_init(&vrp->tx_lock);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  868  	init_waitqueue_head(&vrp->sendq);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  869  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  870  	/* We expect two virtqueues, rx and tx (and in this order) */
9b2bbdb22758845 Michael S. Tsirkin   2017-03-06  871  	err = virtio_find_vqs(vdev, 2, vqs, vq_cbs, names, NULL);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  872  	if (err)
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  873  		goto free_vrp;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  874  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  875  	vrp->rvq = vqs[0];
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  876  	vrp->svq = vqs[1];
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  877  
b1b9891441fa33f Suman Anna           2014-09-16  878  	/* we expect symmetric tx/rx vrings */
b1b9891441fa33f Suman Anna           2014-09-16  879  	WARN_ON(virtqueue_get_vring_size(vrp->rvq) !=
b1b9891441fa33f Suman Anna           2014-09-16  880  		virtqueue_get_vring_size(vrp->svq));
b1b9891441fa33f Suman Anna           2014-09-16  881  
b1b9891441fa33f Suman Anna           2014-09-16  882  	/* we need less buffers if vrings are small */
b1b9891441fa33f Suman Anna           2014-09-16  883  	if (virtqueue_get_vring_size(vrp->rvq) < MAX_RPMSG_NUM_BUFS / 2)
b1b9891441fa33f Suman Anna           2014-09-16  884  		vrp->num_bufs = virtqueue_get_vring_size(vrp->rvq) * 2;
b1b9891441fa33f Suman Anna           2014-09-16  885  	else
b1b9891441fa33f Suman Anna           2014-09-16  886  		vrp->num_bufs = MAX_RPMSG_NUM_BUFS;
b1b9891441fa33f Suman Anna           2014-09-16  887  
f93848f9eeb0f87 Loic Pallardy        2017-03-28  888  	vrp->buf_size = MAX_RPMSG_BUF_SIZE;
f93848f9eeb0f87 Loic Pallardy        2017-03-28  889  
f93848f9eeb0f87 Loic Pallardy        2017-03-28  890  	total_buf_space = vrp->num_bufs * vrp->buf_size;
b1b9891441fa33f Suman Anna           2014-09-16  891  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  892  	/* allocate coherent memory for the buffers */
d999b622fcfb392 Loic Pallardy        2019-01-10  893  	bufs_va = dma_alloc_coherent(vdev->dev.parent,
b1b9891441fa33f Suman Anna           2014-09-16  894  				     total_buf_space, &vrp->bufs_dma,
b1b9891441fa33f Suman Anna           2014-09-16  895  				     GFP_KERNEL);
3119b487e03650b Wei Yongjun          2013-04-29  896  	if (!bufs_va) {
3119b487e03650b Wei Yongjun          2013-04-29  897  		err = -ENOMEM;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  898  		goto vqs_del;
3119b487e03650b Wei Yongjun          2013-04-29  899  	}
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  900  
de4064af76537f1 Suman Anna           2018-10-23  901  	dev_dbg(&vdev->dev, "buffers: va %pK, dma %pad\n",
8d95b322ba34b15 Anna, Suman          2016-08-12  902  		bufs_va, &vrp->bufs_dma);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  903  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  904  	/* half of the buffers is dedicated for RX */
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  905  	vrp->rbufs = bufs_va;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  906  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  907  	/* and half is dedicated for TX */
b1b9891441fa33f Suman Anna           2014-09-16  908  	vrp->sbufs = bufs_va + total_buf_space / 2;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  909  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  910  	/* set up the receive buffers */
b1b9891441fa33f Suman Anna           2014-09-16  911  	for (i = 0; i < vrp->num_bufs / 2; i++) {
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  912  		struct scatterlist sg;
f93848f9eeb0f87 Loic Pallardy        2017-03-28  913  		void *cpu_addr = vrp->rbufs + i * vrp->buf_size;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  914  
9dd87c2af651b09 Loic Pallardy        2017-03-28  915  		rpmsg_sg_init(&sg, cpu_addr, vrp->buf_size);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  916  
cee51d69a45b6ce Rusty Russell        2013-03-20  917  		err = virtqueue_add_inbuf(vrp->rvq, &sg, 1, cpu_addr,
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  918  					  GFP_KERNEL);
57e1a37347d31c6 Rusty Russell        2012-10-16  919  		WARN_ON(err); /* sanity check; this can't really happen */
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  920  	}
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  921  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  922  	/* suppress "tx-complete" interrupts */
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  923  	virtqueue_disable_cb(vrp->svq);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  924  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  925  	vdev->priv = vrp;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  926  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  927  	/* if supported by the remote processor, enable the name service */
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  928  	if (virtio_has_feature(vdev, VIRTIO_RPMSG_F_NS)) {
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  929  		vch = kzalloc(sizeof(*vch), GFP_KERNEL);

Not initialized if virtio_has_feature() is false.

950a7388f02bf77 Arnaud Pouliquen     2020-11-20  930  		if (!vch) {
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  931  			err = -ENOMEM;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  932  			goto free_coherent;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  933  		}
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  934  
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  935  		/* Link the channel to our vrp */
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  936  		vch->vrp = vrp;
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  937  
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  938  		/* Assign public information to the rpmsg_device */
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  939  		rpdev_ns = &vch->rpdev;
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  940  		rpdev_ns->ops = &virtio_rpmsg_ops;
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  941  		rpdev_ns->little_endian = virtio_is_little_endian(vrp->vdev);
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  942  
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  943  		rpdev_ns->dev.parent = &vrp->vdev->dev;
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  944  		rpdev_ns->dev.release = virtio_rpmsg_release_device;
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  945  
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  946  		err = rpmsg_ns_register_device(rpdev_ns);
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  947  		if (err)
950a7388f02bf77 Arnaud Pouliquen     2020-11-20  948  			goto free_coherent;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  949  	}
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  950  
532ff49403675dd Arnaud Pouliquen     2020-12-22  951  	rpdev_ctrl = rpmsg_virtio_add_char_dev(vdev);
532ff49403675dd Arnaud Pouliquen     2020-12-22  952  	if (IS_ERR(rpdev_ctrl)) {
532ff49403675dd Arnaud Pouliquen     2020-12-22  953  		err = PTR_ERR(rpdev_ctrl);
532ff49403675dd Arnaud Pouliquen     2020-12-22  954  		goto free_coherent;
532ff49403675dd Arnaud Pouliquen     2020-12-22  955  	}
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  956  	/*
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  957  	 * Prepare to kick but don't notify yet - we can't do this before
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  958  	 * device is ready.
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  959  	 */
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  960  	notify = virtqueue_kick_prepare(vrp->rvq);
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  961  
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  962  	/* From this point on, we can notify and get callbacks. */
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  963  	virtio_device_ready(vdev);
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  964  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  965  	/* tell the remote processor it can start sending messages */
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  966  	/*
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  967  	 * this might be concurrent with callbacks, but we are only
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  968  	 * doing notify, not a full kick here, so that's ok.
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  969  	 */
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  970  	if (notify)
71e4b8bf0482fc7 Michael S. Tsirkin   2015-03-12  971  		virtqueue_notify(vrp->rvq);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  972  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  973  	dev_info(&vdev->dev, "rpmsg host is online\n");
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  974  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  975  	return 0;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  976  
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  977  free_coherent:
950a7388f02bf77 Arnaud Pouliquen     2020-11-20 @978  	kfree(vch);
                                                        ^^^^^^^^^^^

532ff49403675dd Arnaud Pouliquen     2020-12-22 @979  	kfree(to_virtio_rpmsg_channel(rpdev_ctrl));
                                                                                      ^^^^^^^^^^

d999b622fcfb392 Loic Pallardy        2019-01-10  980  	dma_free_coherent(vdev->dev.parent, total_buf_space,
eeb0074f36d1ab0 Fernando Guzman Lugo 2012-08-29  981  			  bufs_va, vrp->bufs_dma);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  982  vqs_del:
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  983  	vdev->config->del_vqs(vrp->vdev);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  984  free_vrp:
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  985  	kfree(vrp);
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  986  	return err;
bcabbccabffe732 Ohad Ben-Cohen       2011-10-20  987  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32418 bytes --]

  parent reply	other threads:[~2021-01-04 13:03 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 10:57 [PATCH v2 00/16] introduce generic IOCTL interface for RPMsg channels management Arnaud Pouliquen
2020-12-22 10:57 ` [PATCH v2 01/16] rpmsg: introduce RPMsg control driver for channel creation Arnaud Pouliquen
2020-12-22 16:45   ` Randy Dunlap
2021-01-05  0:21   ` Bjorn Andersson
2021-01-21 23:31   ` Mathieu Poirier
2020-12-22 10:57 ` [PATCH v2 02/16] rpmsg: add RPMsg control API to register service Arnaud Pouliquen
2021-01-05  0:34   ` Bjorn Andersson
2021-01-05 16:53     ` Arnaud POULIQUEN
2021-01-21 23:46   ` Mathieu Poirier
2020-12-22 10:57 ` [PATCH v2 03/16] rpmsg: add override field in channel info Arnaud Pouliquen
2020-12-22 10:57 ` [PATCH v2 04/16] rpmsg: ctrl: implement the ioctl function to create device Arnaud Pouliquen
2021-01-05  1:33   ` Bjorn Andersson
2021-01-05 18:07     ` Arnaud POULIQUEN
2021-01-21 23:52   ` Mathieu Poirier
2021-01-22 13:05     ` Arnaud POULIQUEN
2021-01-22 20:59       ` Mathieu Poirier
2021-01-25 10:52         ` Arnaud POULIQUEN
2021-01-29  0:13         ` Mathieu Poirier
2021-01-29  9:45           ` Arnaud POULIQUEN
2020-12-22 10:57 ` [PATCH v2 05/16] rpmsg: ns: initialize channel info override field Arnaud Pouliquen
2021-01-05  0:38   ` Bjorn Andersson
2021-01-05 17:02     ` Arnaud POULIQUEN
2020-12-22 10:57 ` [PATCH v2 06/16] rpmsg: add helper to register the rpmsg ctrl device Arnaud Pouliquen
2020-12-22 10:57 ` [PATCH v2 07/16] rpmsg: char: clean up rpmsg class Arnaud Pouliquen
2021-01-05  0:47   ` Bjorn Andersson
2021-01-05  0:54     ` Bjorn Andersson
2021-01-05 17:03       ` Arnaud POULIQUEN
2020-12-22 10:57 ` [PATCH v2 08/16] rpmsg: char: make char rpmsg a rpmsg device without the control part Arnaud Pouliquen
2020-12-22 10:57 ` [PATCH v2 09/16] rpmsg: char: register RPMsg raw service to the ioctl interface Arnaud Pouliquen
2020-12-22 10:57 ` [PATCH v2 10/16] rpmsg: char: allow only one endpoint per device Arnaud Pouliquen
2021-01-05  0:59   ` Bjorn Andersson
2021-01-05 17:05     ` Arnaud POULIQUEN
2020-12-22 10:57 ` [PATCH v2 11/16] rpmsg: char: check destination address is not null Arnaud Pouliquen
2021-01-05  1:03   ` Bjorn Andersson
2021-01-05 17:08     ` Arnaud POULIQUEN
2020-12-22 10:57 ` [PATCH v2 12/16] rpmsg: virtio: use the driver_override in channel creation ops Arnaud Pouliquen
2020-12-22 10:57 ` [PATCH v2 13/16] rpmsg: virtio: probe the rpmsg_ctl device Arnaud Pouliquen
2020-12-29  4:16   ` kernel test robot
2021-01-04 12:59   ` Dan Carpenter [this message]
2020-12-22 10:57 ` [PATCH v2 14/16] rpmsg: glink: add create and release rpmsg channel ops Arnaud Pouliquen
2021-01-05  1:08   ` Bjorn Andersson
2021-01-05 17:29     ` Arnaud POULIQUEN
2020-12-22 10:57 ` [PATCH v2 15/16] rpmsg: smd: " Arnaud Pouliquen
2020-12-22 10:57 ` [PATCH v2 16/16] rpmsg: replace rpmsg_chrdev_register_device use Arnaud Pouliquen
2021-01-05  1:10   ` Bjorn Andersson
2021-01-04 23:03 ` [PATCH v2 00/16] introduce generic IOCTL interface for RPMsg channels management Bjorn Andersson
2021-01-05 16:59   ` Arnaud POULIQUEN
2021-01-13 20:31 ` Mathieu Poirier
2021-01-14  9:05   ` Arnaud POULIQUEN

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=20210104125950.GP2809@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=agross@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=lkp@intel.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=ohad@wizery.com \
    /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;
as well as URLs for NNTP newsgroup(s).