[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202601141928.CyFxDTEk-lkp@intel.com>
Date: Wed, 14 Jan 2026 20:17:46 +0800
From: kernel test robot <lkp@...el.com>
To: Minu Jin <s9430939@...er.com>, gregkh@...uxfoundation.org
Cc: oe-kbuild-all@...ts.linux.dev, ovidiu.panait.oss@...il.com,
gshahrouzi@...il.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, Minu Jin <s9430939@...er.com>
Subject: Re: [PATCH 2/2] staging: axis-fifo: Use bulk I/O accessors for data
transfers
Hi Minu,
kernel test robot noticed the following build warnings:
[auto build test WARNING on staging/staging-linus]
[also build test WARNING on linus/master v6.19-rc5]
[cannot apply to staging/staging-testing staging/staging-next next-20260114]
[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/Minu-Jin/staging-axis-fifo-introduce-helper-functions-for-register-access/20260113-215835
base: staging/staging-linus
patch link: https://lore.kernel.org/r/20260113133831.3422480-3-s9430939%40naver.com
patch subject: [PATCH 2/2] staging: axis-fifo: Use bulk I/O accessors for data transfers
config: powerpc-randconfig-001-20260114 (https://download.01.org/0day-ci/archive/20260114/202601141928.CyFxDTEk-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260114/202601141928.CyFxDTEk-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601141928.CyFxDTEk-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/staging/axis-fifo/axis-fifo.c: In function 'axis_fifo_read':
>> drivers/staging/axis-fifo/axis-fifo.c:203:22: warning: unused variable 'i' [-Wunused-variable]
203 | unsigned int i;
| ^
vim +/i +203 drivers/staging/axis-fifo/axis-fifo.c
4a965c5f89decd Jacob Feder 2018-07-22 179
0443b3f4436321 Quentin Deslandes 2020-01-21 180 /**
bbf40b2f6e38d0 Lee Jones 2021-04-14 181 * axis_fifo_read() - Read a packet from AXIS-FIFO character device.
c848434c629db5 Lee Jones 2021-04-14 182 * @f: Open file.
c848434c629db5 Lee Jones 2021-04-14 183 * @buf: User space buffer to read to.
c848434c629db5 Lee Jones 2021-04-14 184 * @len: User space buffer length.
c848434c629db5 Lee Jones 2021-04-14 185 * @off: Buffer offset.
0443b3f4436321 Quentin Deslandes 2020-01-21 186 *
0443b3f4436321 Quentin Deslandes 2020-01-21 187 * As defined by the device's documentation, we need to check the device's
0443b3f4436321 Quentin Deslandes 2020-01-21 188 * occupancy before reading the length register and then the data. All these
0443b3f4436321 Quentin Deslandes 2020-01-21 189 * operations must be executed atomically, in order and one after the other
0443b3f4436321 Quentin Deslandes 2020-01-21 190 * without missing any.
0443b3f4436321 Quentin Deslandes 2020-01-21 191 *
0443b3f4436321 Quentin Deslandes 2020-01-21 192 * Returns the number of bytes read from the device or negative error code
0443b3f4436321 Quentin Deslandes 2020-01-21 193 * on failure.
0443b3f4436321 Quentin Deslandes 2020-01-21 194 */
4a965c5f89decd Jacob Feder 2018-07-22 195 static ssize_t axis_fifo_read(struct file *f, char __user *buf,
4a965c5f89decd Jacob Feder 2018-07-22 196 size_t len, loff_t *off)
4a965c5f89decd Jacob Feder 2018-07-22 197 {
4a965c5f89decd Jacob Feder 2018-07-22 198 struct axis_fifo *fifo = (struct axis_fifo *)f->private_data;
4a965c5f89decd Jacob Feder 2018-07-22 199 size_t bytes_available;
4a965c5f89decd Jacob Feder 2018-07-22 200 unsigned int words_available;
4a965c5f89decd Jacob Feder 2018-07-22 201 unsigned int copied;
4a965c5f89decd Jacob Feder 2018-07-22 202 unsigned int copy;
4a965c5f89decd Jacob Feder 2018-07-22 @203 unsigned int i;
4a965c5f89decd Jacob Feder 2018-07-22 204 int ret;
4a965c5f89decd Jacob Feder 2018-07-22 205 u32 tmp_buf[READ_BUF_SIZE];
4a965c5f89decd Jacob Feder 2018-07-22 206
89443a92c506dc Ovidiu Panait 2025-09-19 207 if (f->f_flags & O_NONBLOCK) {
0443b3f4436321 Quentin Deslandes 2020-01-21 208 /*
0443b3f4436321 Quentin Deslandes 2020-01-21 209 * Device opened in non-blocking mode. Try to lock it and then
0443b3f4436321 Quentin Deslandes 2020-01-21 210 * check if any packet is available.
4a965c5f89decd Jacob Feder 2018-07-22 211 */
0443b3f4436321 Quentin Deslandes 2020-01-21 212 if (!mutex_trylock(&fifo->read_lock))
4a965c5f89decd Jacob Feder 2018-07-22 213 return -EAGAIN;
0443b3f4436321 Quentin Deslandes 2020-01-21 214
58e835695afaef Minu Jin 2026-01-13 215 if (!axis_fifo_read_reg(fifo, XLLF_RDFO_OFFSET)) {
0443b3f4436321 Quentin Deslandes 2020-01-21 216 ret = -EAGAIN;
0443b3f4436321 Quentin Deslandes 2020-01-21 217 goto end_unlock;
0443b3f4436321 Quentin Deslandes 2020-01-21 218 }
4a965c5f89decd Jacob Feder 2018-07-22 219 } else {
4a965c5f89decd Jacob Feder 2018-07-22 220 /* opened in blocking mode
4a965c5f89decd Jacob Feder 2018-07-22 221 * wait for a packet available interrupt (or timeout)
4a965c5f89decd Jacob Feder 2018-07-22 222 * if nothing is currently available
4a965c5f89decd Jacob Feder 2018-07-22 223 */
0443b3f4436321 Quentin Deslandes 2020-01-21 224 mutex_lock(&fifo->read_lock);
0443b3f4436321 Quentin Deslandes 2020-01-21 225 ret = wait_event_interruptible_timeout(fifo->read_queue,
58e835695afaef Minu Jin 2026-01-13 226 axis_fifo_read_reg(fifo, XLLF_RDFO_OFFSET),
752cbd8f191678 Khadija Kamran 2023-03-17 227 read_timeout);
4a965c5f89decd Jacob Feder 2018-07-22 228
0443b3f4436321 Quentin Deslandes 2020-01-21 229 if (ret <= 0) {
4a965c5f89decd Jacob Feder 2018-07-22 230 if (ret == 0) {
0443b3f4436321 Quentin Deslandes 2020-01-21 231 ret = -EAGAIN;
0443b3f4436321 Quentin Deslandes 2020-01-21 232 } else if (ret != -ERESTARTSYS) {
4a965c5f89decd Jacob Feder 2018-07-22 233 dev_err(fifo->dt_device, "wait_event_interruptible_timeout() error in read (ret=%i)\n",
4a965c5f89decd Jacob Feder 2018-07-22 234 ret);
0443b3f4436321 Quentin Deslandes 2020-01-21 235 }
0443b3f4436321 Quentin Deslandes 2020-01-21 236
0443b3f4436321 Quentin Deslandes 2020-01-21 237 goto end_unlock;
4a965c5f89decd Jacob Feder 2018-07-22 238 }
4a965c5f89decd Jacob Feder 2018-07-22 239 }
4a965c5f89decd Jacob Feder 2018-07-22 240
58e835695afaef Minu Jin 2026-01-13 241 bytes_available = axis_fifo_read_reg(fifo, XLLF_RLR_OFFSET);
82a051e2553b9e Ovidiu Panait 2025-09-12 242 words_available = bytes_available / sizeof(u32);
4a965c5f89decd Jacob Feder 2018-07-22 243 if (!bytes_available) {
c6e8d85fafa719 Gabriel Shahrouzi 2025-04-18 244 dev_err(fifo->dt_device, "received a packet of length 0\n");
0443b3f4436321 Quentin Deslandes 2020-01-21 245 ret = -EIO;
0443b3f4436321 Quentin Deslandes 2020-01-21 246 goto end_unlock;
4a965c5f89decd Jacob Feder 2018-07-22 247 }
4a965c5f89decd Jacob Feder 2018-07-22 248
4a965c5f89decd Jacob Feder 2018-07-22 249 if (bytes_available > len) {
c6e8d85fafa719 Gabriel Shahrouzi 2025-04-18 250 dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu)\n",
4a965c5f89decd Jacob Feder 2018-07-22 251 bytes_available, len);
0443b3f4436321 Quentin Deslandes 2020-01-21 252 ret = -EINVAL;
82a051e2553b9e Ovidiu Panait 2025-09-12 253 goto err_flush_rx;
4a965c5f89decd Jacob Feder 2018-07-22 254 }
4a965c5f89decd Jacob Feder 2018-07-22 255
4a965c5f89decd Jacob Feder 2018-07-22 256 if (bytes_available % sizeof(u32)) {
4a965c5f89decd Jacob Feder 2018-07-22 257 /* this probably can't happen unless IP
4a965c5f89decd Jacob Feder 2018-07-22 258 * registers were previously mishandled
4a965c5f89decd Jacob Feder 2018-07-22 259 */
c6e8d85fafa719 Gabriel Shahrouzi 2025-04-18 260 dev_err(fifo->dt_device, "received a packet that isn't word-aligned\n");
0443b3f4436321 Quentin Deslandes 2020-01-21 261 ret = -EIO;
82a051e2553b9e Ovidiu Panait 2025-09-12 262 goto err_flush_rx;
4a965c5f89decd Jacob Feder 2018-07-22 263 }
4a965c5f89decd Jacob Feder 2018-07-22 264
4a965c5f89decd Jacob Feder 2018-07-22 265 /* read data into an intermediate buffer, copying the contents
4a965c5f89decd Jacob Feder 2018-07-22 266 * to userspace when the buffer is full
4a965c5f89decd Jacob Feder 2018-07-22 267 */
4a965c5f89decd Jacob Feder 2018-07-22 268 copied = 0;
4a965c5f89decd Jacob Feder 2018-07-22 269 while (words_available > 0) {
4a965c5f89decd Jacob Feder 2018-07-22 270 copy = min(words_available, READ_BUF_SIZE);
4a965c5f89decd Jacob Feder 2018-07-22 271
884090d9d589b8 Minu Jin 2026-01-13 272 axis_fifo_read_data(fifo, tmp_buf, copy);
884090d9d589b8 Minu Jin 2026-01-13 273
82a051e2553b9e Ovidiu Panait 2025-09-12 274 words_available -= copy;
4a965c5f89decd Jacob Feder 2018-07-22 275
4a965c5f89decd Jacob Feder 2018-07-22 276 if (copy_to_user(buf + copied * sizeof(u32), tmp_buf,
4a965c5f89decd Jacob Feder 2018-07-22 277 copy * sizeof(u32))) {
0443b3f4436321 Quentin Deslandes 2020-01-21 278 ret = -EFAULT;
82a051e2553b9e Ovidiu Panait 2025-09-12 279 goto err_flush_rx;
4a965c5f89decd Jacob Feder 2018-07-22 280 }
4a965c5f89decd Jacob Feder 2018-07-22 281
4a965c5f89decd Jacob Feder 2018-07-22 282 copied += copy;
4a965c5f89decd Jacob Feder 2018-07-22 283 }
82a051e2553b9e Ovidiu Panait 2025-09-12 284 mutex_unlock(&fifo->read_lock);
82a051e2553b9e Ovidiu Panait 2025-09-12 285
82a051e2553b9e Ovidiu Panait 2025-09-12 286 return bytes_available;
4a965c5f89decd Jacob Feder 2018-07-22 287
82a051e2553b9e Ovidiu Panait 2025-09-12 288 err_flush_rx:
82a051e2553b9e Ovidiu Panait 2025-09-12 289 while (words_available--)
82a051e2553b9e Ovidiu Panait 2025-09-12 290 ioread32(fifo->base_addr + XLLF_RDFD_OFFSET);
0443b3f4436321 Quentin Deslandes 2020-01-21 291
0443b3f4436321 Quentin Deslandes 2020-01-21 292 end_unlock:
0443b3f4436321 Quentin Deslandes 2020-01-21 293 mutex_unlock(&fifo->read_lock);
0443b3f4436321 Quentin Deslandes 2020-01-21 294
0443b3f4436321 Quentin Deslandes 2020-01-21 295 return ret;
4a965c5f89decd Jacob Feder 2018-07-22 296 }
4a965c5f89decd Jacob Feder 2018-07-22 297
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists