[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202204120034.naMtjHQQ-lkp@intel.com>
Date: Tue, 12 Apr 2022 00:29:28 +0800
From: kernel test robot <lkp@...el.com>
To: Jiri Slaby <jslaby@...e.cz>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [jirislaby:devel 48/48] drivers/tty/serial/atmel_serial.c:985:13:
warning: variable 'sg_len' is uninitialized when used here
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git devel
head: c196e3b15cddb539135de6a3c6bcf32b89213b4c
commit: c196e3b15cddb539135de6a3c6bcf32b89213b4c [48/48] tty: serial, use kfifo
config: hexagon-randconfig-r045-20220411 (https://download.01.org/0day-ci/archive/20220412/202204120034.naMtjHQQ-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c6e83f560f06cdfe8aa47b248d8bdc58f947274b)
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=c196e3b15cddb539135de6a3c6bcf32b89213b4c
git remote add jirislaby https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git
git fetch --no-tags jirislaby devel
git checkout c196e3b15cddb539135de6a3c6bcf32b89213b4c
# 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@...el.com>
All warnings (new ones prefixed by >>):
drivers/tty/serial/atmel_serial.c:927:23: warning: variable 'part1_len' set but not used [-Wunused-but-set-variable]
unsigned int tx_len, part1_len, part2_len, sg_len;
^
drivers/tty/serial/atmel_serial.c:927:34: warning: variable 'part2_len' set but not used [-Wunused-but-set-variable]
unsigned int tx_len, part1_len, part2_len, sg_len;
^
>> 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:51: note: initialize the variable 'sg_len' to silence this warning
unsigned int tx_len, part1_len, part2_len, sg_len;
^
= 0
3 warnings generated.
--
>> drivers/tty/serial/serial-tegra.c:584:25: warning: variable 'count' is uninitialized when used here [-Wuninitialized]
if (tup->use_tx_pio || count < TEGRA_UART_MIN_DMA)
^~~~~
drivers/tty/serial/serial-tegra.c:571:21: note: initialize the variable 'count' to silence this warning
unsigned long count;
^
= 0
>> drivers/tty/serial/serial-tegra.c:586:26: warning: variable 'tail' is uninitialized when used here [-Wuninitialized]
else if (BYTES_TO_ALIGN(tail) > 0)
^~~~
drivers/tty/serial/serial-tegra.c:39:46: note: expanded from macro 'BYTES_TO_ALIGN'
#define BYTES_TO_ALIGN(x) ((unsigned long)(x) & 0x3)
^
drivers/tty/serial/serial-tegra.c:570:20: note: initialize the variable 'tail' to silence this warning
unsigned long tail;
^
= 0
>> drivers/tty/serial/serial-tegra.c:1188:26: warning: variable 'dma_buf' is uninitialized when used here [-Wuninitialized]
tup->tx_dma_buf_virt = dma_buf;
^~~~~~~
drivers/tty/serial/serial-tegra.c:1140:24: note: initialize the variable 'dma_buf' to silence this warning
unsigned char *dma_buf;
^
= NULL
>> drivers/tty/serial/serial-tegra.c:1189:26: warning: variable 'dma_phys' is uninitialized when used here [-Wuninitialized]
tup->tx_dma_buf_phys = dma_phys;
^~~~~~~~
drivers/tty/serial/serial-tegra.c:1141:21: note: initialize the variable 'dma_phys' to silence this warning
dma_addr_t dma_phys;
^
= 0
4 warnings generated.
vim +/sg_len +985 drivers/tty/serial/atmel_serial.c
08f738be88bb7a Elen Song 2013-07-22 916
08f738be88bb7a Elen Song 2013-07-22 917 /*
08f738be88bb7a Elen Song 2013-07-22 918 * Called from tasklet with TXRDY interrupt is disabled.
08f738be88bb7a Elen Song 2013-07-22 919 */
08f738be88bb7a Elen Song 2013-07-22 920 static void atmel_tx_dma(struct uart_port *port)
08f738be88bb7a Elen Song 2013-07-22 921 {
08f738be88bb7a Elen Song 2013-07-22 922 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
c196e3b15cddb5 Jiri Slaby 2022-01-05 923 struct tty_port *tport = &port->state->port;
08f738be88bb7a Elen Song 2013-07-22 924 struct dma_chan *chan = atmel_port->chan_tx;
08f738be88bb7a Elen Song 2013-07-22 925 struct dma_async_tx_descriptor *desc;
c196e3b15cddb5 Jiri Slaby 2022-01-05 926 struct scatterlist sgl[2], /**sg,*/ *sg_tx = &atmel_port->sg_tx;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 @927 unsigned int tx_len, part1_len, part2_len, sg_len;
c196e3b15cddb5 Jiri Slaby 2022-01-05 928 //dma_addr_t phys_addr;
08f738be88bb7a Elen Song 2013-07-22 929
08f738be88bb7a Elen Song 2013-07-22 930 /* Make sure we have an idle channel */
08f738be88bb7a Elen Song 2013-07-22 931 if (atmel_port->desc_tx != NULL)
08f738be88bb7a Elen Song 2013-07-22 932 return;
08f738be88bb7a Elen Song 2013-07-22 933
c196e3b15cddb5 Jiri Slaby 2022-01-05 934 if (!kfifo_is_empty(&tport->xmit_fifo) && !uart_tx_stopped(port)) {
08f738be88bb7a Elen Song 2013-07-22 935 /*
08f738be88bb7a Elen Song 2013-07-22 936 * DMA is idle now.
08f738be88bb7a Elen Song 2013-07-22 937 * Port xmit buffer is already mapped,
08f738be88bb7a Elen Song 2013-07-22 938 * and it is one page... Just adjust
08f738be88bb7a Elen Song 2013-07-22 939 * offsets and lengths. Since it is a circular buffer,
08f738be88bb7a Elen Song 2013-07-22 940 * we have to transmit till the end, and then the rest.
08f738be88bb7a Elen Song 2013-07-22 941 * Take the port lock to get a
08f738be88bb7a Elen Song 2013-07-22 942 * consistent xmit buffer state.
08f738be88bb7a Elen Song 2013-07-22 943 */
c196e3b15cddb5 Jiri Slaby 2022-01-05 944 tx_len = 0;/*CIRC_CNT_TO_END(xmit->head,
08f738be88bb7a Elen Song 2013-07-22 945 xmit->tail,
c196e3b15cddb5 Jiri Slaby 2022-01-05 946 UART_XMIT_SIZE);*/
5f258b3e3d223b Cyrille Pitchen 2015-07-02 947
5f258b3e3d223b Cyrille Pitchen 2015-07-02 948 if (atmel_port->fifo_size) {
5f258b3e3d223b Cyrille Pitchen 2015-07-02 949 /* multi data mode */
5f258b3e3d223b Cyrille Pitchen 2015-07-02 950 part1_len = (tx_len & ~0x3); /* DWORD access */
5f258b3e3d223b Cyrille Pitchen 2015-07-02 951 part2_len = (tx_len & 0x3); /* BYTE access */
5f258b3e3d223b Cyrille Pitchen 2015-07-02 952 } else {
5f258b3e3d223b Cyrille Pitchen 2015-07-02 953 /* single data (legacy) mode */
5f258b3e3d223b Cyrille Pitchen 2015-07-02 954 part1_len = 0;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 955 part2_len = tx_len; /* BYTE access only */
5f258b3e3d223b Cyrille Pitchen 2015-07-02 956 }
5f258b3e3d223b Cyrille Pitchen 2015-07-02 957
c196e3b15cddb5 Jiri Slaby 2022-01-05 958 #if 0
5f258b3e3d223b Cyrille Pitchen 2015-07-02 959 sg_init_table(sgl, 2);
5f258b3e3d223b Cyrille Pitchen 2015-07-02 960 sg_len = 0;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 961 phys_addr = sg_dma_address(sg_tx) + xmit->tail;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 962 if (part1_len) {
5f258b3e3d223b Cyrille Pitchen 2015-07-02 963 sg = &sgl[sg_len++];
5f258b3e3d223b Cyrille Pitchen 2015-07-02 964 sg_dma_address(sg) = phys_addr;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 965 sg_dma_len(sg) = part1_len;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 966
5f258b3e3d223b Cyrille Pitchen 2015-07-02 967 phys_addr += part1_len;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 968 }
5f258b3e3d223b Cyrille Pitchen 2015-07-02 969
5f258b3e3d223b Cyrille Pitchen 2015-07-02 970 if (part2_len) {
5f258b3e3d223b Cyrille Pitchen 2015-07-02 971 sg = &sgl[sg_len++];
5f258b3e3d223b Cyrille Pitchen 2015-07-02 972 sg_dma_address(sg) = phys_addr;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 973 sg_dma_len(sg) = part2_len;
5f258b3e3d223b Cyrille Pitchen 2015-07-02 974 }
c196e3b15cddb5 Jiri Slaby 2022-01-05 975 #endif
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
c196e3b15cddb5 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 985 was first introduced by commit
:::::: 5f258b3e3d223b5cb6d1753b2f9b821ba4455f81 tty/serial: at91: use 32bit writes into TX FIFO when DMA is enabled
:::::: TO: Cyrille Pitchen <cyrille.pitchen@...el.com>
:::::: CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists