[jirislaby:devel 49/49] drivers/tty/serial/men_z135_uart.c:346:6: warning: variable '__tmp' is uninitialized when used within its own initialization
From: kernel test robot
Date: Wed Apr 13 2022 - 11:47:18 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git devel
head: af0ac0f5161e051a3e4a2a669e377bdc2439920e
commit: af0ac0f5161e051a3e4a2a669e377bdc2439920e [49/49] tty: serial, use kfifo
config: arm64-buildonly-randconfig-r003-20220413 (https://download.01.org/0day-ci/archive/20220413/202204132329.LphHCVTD-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 6b7e6ea489f6dd45a9b0da9ac20871560917b9b0)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/commit/?id=af0ac0f5161e051a3e4a2a669e377bdc2439920e
git remote add jirislaby https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git
git fetch --no-tags jirislaby devel
git checkout af0ac0f5161e051a3e4a2a669e377bdc2439920e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/tty/serial/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> drivers/tty/serial/men_z135_uart.c:346:6: warning: variable '__tmp' is uninitialized when used within its own initialization [-Wuninitialized]
n = kfifo_out_linear_ptr(&tport->xmit_fifo, &tail,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:850:42: note: expanded from macro 'kfifo_out_linear_ptr'
unsigned int __count = kfifo_out_linear(__tmp, &___tail, (n)); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:834:30: note: expanded from macro 'kfifo_out_linear'
typeof((fifo) + 1) __tmp = (fifo); \
~~~~~ ^~~~
1 warning generated.
vim +/__tmp +346 drivers/tty/serial/men_z135_uart.c
287
288 /**
289 * men_z135_handle_tx() - TX tasklet routine
290 * @uart: Pointer to struct men_z135_port
291 *
292 */
293 static void men_z135_handle_tx(struct men_z135_port *uart)
294 {
295 struct uart_port *port = &uart->port;
296 struct tty_port *tport = &port->state->port;
297 unsigned char *tail;
298 unsigned int n, txfree;
299 u32 txc;
300 u32 wptr;
301 int qlen;
302
303 if (kfifo_is_empty(&tport->xmit_fifo))
304 goto out;
305
306 if (uart_tx_stopped(port))
307 goto out;
308
309 if (port->x_char)
310 goto out;
311
312 /* calculate bytes to copy */
313 qlen = kfifo_len(&tport->xmit_fifo);
314 if (qlen <= 0)
315 goto out;
316
317 wptr = ioread32(port->membase + MEN_Z135_TX_CTRL);
318 txc = (wptr >> 16) & 0x3ff;
319 wptr &= 0x3ff;
320
321 if (txc > MEN_Z135_FIFO_WATERMARK)
322 txc = MEN_Z135_FIFO_WATERMARK;
323
324 txfree = MEN_Z135_FIFO_WATERMARK - txc;
325 if (txfree <= 0) {
326 dev_err(&uart->mdev->dev,
327 "Not enough room in TX FIFO have %d, need %d\n",
328 txfree, qlen);
329 goto irq_en;
330 }
331
332 /* if we're not aligned, it's better to copy only 1 or 2 bytes and
333 * then the rest.
334 */
335 if (align && qlen >= 3 && BYTES_TO_ALIGN(wptr))
336 n = 4 - BYTES_TO_ALIGN(wptr);
337 else if (qlen > txfree)
338 n = txfree;
339 else
340 n = qlen;
341
342 if (n <= 0)
343 goto irq_en;
344
345
> 346 n = kfifo_out_linear_ptr(&tport->xmit_fifo, &tail,
347 min_t(unsigned int, UART_XMIT_SIZE, n));
348 memcpy_toio(port->membase + MEN_Z135_TX_RAM, tail, n);
349 kfifo_dma_out_finish(&tport->xmit_fifo, n);
350
351 iowrite32(n & 0x3ff, port->membase + MEN_Z135_TX_CTRL);
352
353 port->icount.tx += n;
354
355 if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
356 uart_write_wakeup(port);
357
358 irq_en:
359 if (!kfifo_is_empty(&tport->xmit_fifo))
360 men_z135_reg_set(uart, MEN_Z135_CONF_REG, MEN_Z135_IER_TXCIEN);
361 else
362 men_z135_reg_clr(uart, MEN_Z135_CONF_REG, MEN_Z135_IER_TXCIEN);
363
364 out:
365 return;
366
--
0-DAY CI Kernel Test Service
https://01.org/lkp