[jirislaby:devel 48/48] drivers/tty/serial/atmel_serial.c:981:24: warning: variable 'tx_len' is uninitialized when used here

From: kernel test robot
Date: Tue Apr 12 2022 - 12:32:21 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git devel
head: ea94a80635daaf36a289f1ec1f982b1e094faeca
commit: ea94a80635daaf36a289f1ec1f982b1e094faeca [48/48] tty: serial, use kfifo
config: hexagon-randconfig-r045-20220411 (https://download.01.org/0day-ci/archive/20220413/202204130036.n7mzFmFK-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project fe2478d44e4f7f191c43fef629ac7a23d0251e72)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/commit/?id=ea94a80635daaf36a289f1ec1f982b1e094faeca
git remote add jirislaby https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git
git fetch --no-tags jirislaby devel
git checkout ea94a80635daaf36a289f1ec1f982b1e094faeca
# 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=hexagon 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/atmel_serial.c:981:24: warning: variable 'tx_len' is uninitialized when used here [-Wuninitialized]
atmel_port->tx_len = tx_len;
^~~~~~
drivers/tty/serial/atmel_serial.c:927:21: note: initialize the variable 'tx_len' to silence this warning
unsigned int tx_len, /*part1_len, part2_len,*/ sg_len;
^
= 0
drivers/tty/serial/atmel_serial.c:985:13: warning: variable 'sg_len' is uninitialized when used here [-Wuninitialized]
sg_len,
^~~~~~
drivers/tty/serial/atmel_serial.c:927:55: note: initialize the variable 'sg_len' to silence this warning
unsigned int tx_len, /*part1_len, part2_len,*/ sg_len;
^
= 0
2 warnings generated.


vim +/tx_len +981 drivers/tty/serial/atmel_serial.c

5f258b3e3d223b Cyrille Pitchen 2015-07-02 976
5f258b3e3d223b Cyrille Pitchen 2015-07-02 977 /*
5f258b3e3d223b Cyrille Pitchen 2015-07-02 978 * save tx_len so atmel_complete_tx_dma() will increase
5f258b3e3d223b Cyrille Pitchen 2015-07-02 979 * xmit->tail correctly
5f258b3e3d223b Cyrille Pitchen 2015-07-02 980 */
5f258b3e3d223b Cyrille Pitchen 2015-07-02 @981 atmel_port->tx_len = tx_len;
08f738be88bb7a Elen Song 2013-07-22 982
08f738be88bb7a Elen Song 2013-07-22 983 desc = dmaengine_prep_slave_sg(chan,
5f258b3e3d223b Cyrille Pitchen 2015-07-02 984 sgl,
5f258b3e3d223b Cyrille Pitchen 2015-07-02 985 sg_len,
08f738be88bb7a Elen Song 2013-07-22 986 DMA_MEM_TO_DEV,
08f738be88bb7a Elen Song 2013-07-22 987 DMA_PREP_INTERRUPT |
08f738be88bb7a Elen Song 2013-07-22 988 DMA_CTRL_ACK);
08f738be88bb7a Elen Song 2013-07-22 989 if (!desc) {
08f738be88bb7a Elen Song 2013-07-22 990 dev_err(port->dev, "Failed to send via dma!\n");
08f738be88bb7a Elen Song 2013-07-22 991 return;
08f738be88bb7a Elen Song 2013-07-22 992 }
08f738be88bb7a Elen Song 2013-07-22 993
5f258b3e3d223b Cyrille Pitchen 2015-07-02 994 dma_sync_sg_for_device(port->dev, sg_tx, 1, DMA_TO_DEVICE);
08f738be88bb7a Elen Song 2013-07-22 995
08f738be88bb7a Elen Song 2013-07-22 996 atmel_port->desc_tx = desc;
08f738be88bb7a Elen Song 2013-07-22 997 desc->callback = atmel_complete_tx_dma;
08f738be88bb7a Elen Song 2013-07-22 998 desc->callback_param = atmel_port;
08f738be88bb7a Elen Song 2013-07-22 999 atmel_port->cookie_tx = dmaengine_submit(desc);
1e67bd2b8cb90b Tudor Ambarus 2021-11-25 1000 if (dma_submit_error(atmel_port->cookie_tx)) {
1e67bd2b8cb90b Tudor Ambarus 2021-11-25 1001 dev_err(port->dev, "dma_submit_error %d\n",
1e67bd2b8cb90b Tudor Ambarus 2021-11-25 1002 atmel_port->cookie_tx);
1e67bd2b8cb90b Tudor Ambarus 2021-11-25 1003 return;
1e67bd2b8cb90b Tudor Ambarus 2021-11-25 1004 }
4f4b9b5895614e Tudor Ambarus 2021-11-25 1005
4f4b9b5895614e Tudor Ambarus 2021-11-25 1006 dma_async_issue_pending(chan);
08f738be88bb7a Elen Song 2013-07-22 1007 }
08f738be88bb7a Elen Song 2013-07-22 1008
ea94a80635daaf Jiri Slaby 2022-01-05 1009 if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
08f738be88bb7a Elen Song 2013-07-22 1010 uart_write_wakeup(port);
08f738be88bb7a Elen Song 2013-07-22 1011 }
08f738be88bb7a Elen Song 2013-07-22 1012

:::::: The code at line 981 was first introduced by commit
:::::: 5f258b3e3d223b5cb6d1753b2f9b821ba4455f81 tty/serial: at91: use 32bit writes into TX FIFO when DMA is enabled

:::::: TO: Cyrille Pitchen <cyrille.pitchen@xxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp