All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Harald Mommer <Harald.Mommer@opensynergy.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH v3 3/3] SPI: Add virtio SPI driver.
Date: Sun, 18 Feb 2024 03:35:16 +0800	[thread overview]
Message-ID: <202402180341.OAy6gqDI-lkp@intel.com> (raw)
In-Reply-To: <20240213135350.5878-4-Harald.Mommer@opensynergy.com>

Hi Harald,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-spi/for-next]
[also build test WARNING on linus/master v6.8-rc4 next-20240216]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Harald-Mommer/virtio-Add-ID-for-virtio-SPI/20240213-220415
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
patch link:    https://lore.kernel.org/r/20240213135350.5878-4-Harald.Mommer%40opensynergy.com
patch subject: [RFC PATCH v3 3/3] SPI: Add virtio SPI driver.
config: riscv-allmodconfig (https://download.01.org/0day-ci/archive/20240218/202402180341.OAy6gqDI-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 36adfec155de366d722f2bac8ff9162289dcf06c)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240218/202402180341.OAy6gqDI-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/202402180341.OAy6gqDI-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/spi/spi-virtio.c:162:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     162 |         if (virtio_spi_set_delays(th, spi, xfer))
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-virtio.c:197:6: note: uninitialized use occurs here
     197 |         if (ret)
         |             ^~~
   drivers/spi/spi-virtio.c:162:2: note: remove the 'if' if its condition is always false
     162 |         if (virtio_spi_set_delays(th, spi, xfer))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     163 |                 goto msg_done;
         |                 ~~~~~~~~~~~~~
   drivers/spi/spi-virtio.c:131:9: note: initialize the variable 'ret' to silence this warning
     131 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +162 drivers/spi/spi-virtio.c

   117	
   118	static int virtio_spi_one_transfer(struct virtio_spi_req *spi_req,
   119					   struct spi_controller *ctrl,
   120					   struct spi_message *msg,
   121					   struct spi_transfer *xfer)
   122	{
   123		struct virtio_spi_priv *priv = spi_controller_get_devdata(ctrl);
   124		struct spi_device *spi = msg->spi;
   125		struct spi_transfer_head *th;
   126		struct scatterlist sg_out_head, sg_out_payload;
   127		struct scatterlist sg_in_result, sg_in_payload;
   128		struct scatterlist *sgs[4];
   129		unsigned int outcnt = 0u;
   130		unsigned int incnt = 0u;
   131		int ret;
   132	
   133		th = &spi_req->transfer_head;
   134	
   135		/* Fill struct spi_transfer_head */
   136		th->chip_select_id = spi_get_chipselect(spi, 0);
   137		th->bits_per_word = spi->bits_per_word;
   138		/*
   139		 * Got comment: "The virtio spec for cs_change is *not* what the Linux
   140		 * cs_change field does, this will not do the right thing."
   141		 * TODO: Understand/discuss this, still unclear what may be wrong here
   142		 */
   143		th->cs_change = xfer->cs_change;
   144		th->tx_nbits = xfer->tx_nbits;
   145		th->rx_nbits = xfer->rx_nbits;
   146		th->reserved[0] = 0;
   147		th->reserved[1] = 0;
   148		th->reserved[2] = 0;
   149	
   150		BUILD_BUG_ON(VIRTIO_SPI_CPHA != SPI_CPHA);
   151		BUILD_BUG_ON(VIRTIO_SPI_CPOL != SPI_CPOL);
   152		BUILD_BUG_ON(VIRTIO_SPI_CS_HIGH != SPI_CS_HIGH);
   153		BUILD_BUG_ON(VIRTIO_SPI_MODE_LSB_FIRST != SPI_LSB_FIRST);
   154	
   155		th->mode = cpu_to_le32(spi->mode & (SPI_LSB_FIRST | SPI_CS_HIGH |
   156						    SPI_CPOL | SPI_CPHA));
   157		if ((spi->mode & SPI_LOOP) != 0)
   158			th->mode |= cpu_to_le32(VIRTIO_SPI_MODE_LOOP);
   159	
   160		th->freq = cpu_to_le32(xfer->speed_hz);
   161	
 > 162		if (virtio_spi_set_delays(th, spi, xfer))
   163			goto msg_done;
   164	
   165		/* Set buffers */
   166		spi_req->tx_buf = xfer->tx_buf;
   167		spi_req->rx_buf = xfer->rx_buf;
   168	
   169		/* Prepare sending of virtio message */
   170		init_completion(&spi_req->completion);
   171	
   172		sg_init_one(&sg_out_head, th, sizeof(*th));
   173		sgs[outcnt] = &sg_out_head;
   174		outcnt++;
   175	
   176		if (spi_req->tx_buf) {
   177			sg_init_one(&sg_out_payload, spi_req->tx_buf, xfer->len);
   178			sgs[outcnt] = &sg_out_payload;
   179			outcnt++;
   180		}
   181	
   182		if (spi_req->rx_buf) {
   183			sg_init_one(&sg_in_payload, spi_req->rx_buf, xfer->len);
   184			sgs[outcnt + incnt] = &sg_in_payload;
   185			incnt++;
   186		}
   187	
   188		sg_init_one(&sg_in_result, &spi_req->result,
   189			    sizeof(struct spi_transfer_result));
   190		sgs[outcnt + incnt] = &sg_in_result;
   191		incnt++;
   192	
   193		ret = virtqueue_add_sgs(priv->vq, sgs, outcnt, incnt, spi_req,
   194					GFP_KERNEL);
   195	
   196	msg_done:
   197		if (ret)
   198			msg->status = ret;
   199	
   200		return ret;
   201	}
   202	

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

  parent reply	other threads:[~2024-02-17 19:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 13:53 [RFC PATCH v3 0/3] Virtio SPI Linux driver compliant to draft spec V10 Harald Mommer
2024-02-13 13:53 ` [virtio-dev] " Harald Mommer
2024-02-13 13:53 ` [RFC PATCH v3 1/3] virtio: Add ID for virtio SPI Harald Mommer
2024-02-13 13:53   ` [virtio-dev] " Harald Mommer
2024-02-13 13:53 ` [RFC PATCH v3 2/3] virtio-spi: Add virtio-spi.h Harald Mommer
2024-02-13 13:53   ` [virtio-dev] " Harald Mommer
2024-02-13 13:53 ` [RFC PATCH v3 3/3] SPI: Add virtio SPI driver Harald Mommer
2024-02-13 13:53   ` [virtio-dev] " Harald Mommer
2024-02-13 17:49   ` Mark Brown
2024-02-27 14:12     ` Harald Mommer
2024-02-27 14:12       ` [virtio-dev] " Harald Mommer
2024-02-27 14:25       ` Mark Brown
2024-02-17 19:35   ` kernel test robot [this message]
2024-02-20  8:30   ` Haixu Cui
2024-02-20  8:30     ` [virtio-dev] " Haixu Cui
2024-02-26 10:41     ` Harald Mommer
2024-02-26 10:41       ` [virtio-dev] " Harald Mommer
2024-03-04  7:11   ` Haixu Cui
2024-03-04  7:11     ` [virtio-dev] " Haixu Cui
2024-03-04 10:52     ` Harald Mommer
2024-03-04 10:52       ` Harald Mommer
2024-03-05  7:46       ` Haixu Cui
2024-03-05 10:57         ` Harald Mommer
2024-03-05 17:54           ` [virtio-dev] Re: [RFC PATCH v3 3/3] SPI: Add virtio SPI driver. - Correction Harald Mommer
2024-03-06  7:48             ` Haixu Cui
2024-03-06 16:18               ` Harald Mommer
2024-03-11  9:28                 ` Haixu Cui
2024-03-13  7:05                   ` Haixu Cui
2024-02-14 16:22 ` [virtio-dev] [RFC PATCH v3 0/3] Virtio SPI Linux driver compliant to draft spec V10 Cornelia Huck
2024-02-14 16:22   ` Cornelia Huck

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=202402180341.OAy6gqDI-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Harald.Mommer@opensynergy.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.