mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev,
	Rengarajan S <rengarajan.s@microchip.com>,
	kumaravel.thiagarajan@microchip.com,
	tharunkumar.pasumarthi@microchip.com, gregkh@linuxfoundation.org,
	jirislaby@kernel.org, keescook@chromium.org,
	gustavoars@kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	unglinuxdriver@microchip.com
Subject: Re: [PATCH v1 tty-next 4/4] 8250: microchip: pci1xxxx: Add Burst mode transmission support in uart driver for reading from FIFO
Date: Tue, 2 Jan 2024 17:06:16 +0300	[thread overview]
Message-ID: <5d46ad8f-6537-4c53-8a81-85dca7bfbd9e@suswa.mountain> (raw)
In-Reply-To: <20231215151123.41812-5-rengarajan.s@microchip.com>

Hi Rengarajan,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Rengarajan-S/8250-microchip-pci1xxxx-Rearranging-the-structure-declarations/20231215-234606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20231215151123.41812-5-rengarajan.s%40microchip.com
patch subject: [PATCH v1 tty-next 4/4] 8250: microchip: pci1xxxx: Add Burst mode transmission support in uart driver for reading from FIFO
config: i386-randconfig-141-20231216 (https://download.01.org/0day-ci/archive/20231216/202312161205.f6EpLZln-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202312161205.f6EpLZln-lkp@intel.com/

smatch warnings:
drivers/tty/serial/8250/8250_pci1xxxx.c:395 pci1xxxx_process_write_data() warn: should this be 'valid_burst_count == -1'

vim +395 drivers/tty/serial/8250/8250_pci1xxxx.c

eeaa9176002041 Rengarajan S 2023-12-15  351  static void pci1xxxx_process_write_data(struct uart_port *port,
eeaa9176002041 Rengarajan S 2023-12-15  352  					struct circ_buf *xmit,
eeaa9176002041 Rengarajan S 2023-12-15  353  					int *data_empty_count,
eeaa9176002041 Rengarajan S 2023-12-15  354  					u32 *valid_byte_count)
eeaa9176002041 Rengarajan S 2023-12-15  355  {
eeaa9176002041 Rengarajan S 2023-12-15  356  	u32 valid_burst_count = *valid_byte_count / UART_BURST_SIZE;
eeaa9176002041 Rengarajan S 2023-12-15  357  
eeaa9176002041 Rengarajan S 2023-12-15  358  	/*
eeaa9176002041 Rengarajan S 2023-12-15  359  	 * Each transaction transfers data in DWORDs. If there are less than
eeaa9176002041 Rengarajan S 2023-12-15  360  	 * four remaining valid_byte_count to transfer or if the circular
eeaa9176002041 Rengarajan S 2023-12-15  361  	 * buffer has insufficient space for a DWORD, the data is transferred
eeaa9176002041 Rengarajan S 2023-12-15  362  	 * one byte at a time.
eeaa9176002041 Rengarajan S 2023-12-15  363  	 */
eeaa9176002041 Rengarajan S 2023-12-15  364  	while (valid_burst_count--) {

This loop ends with valid_burst_count set to -1.  (Post operation).

eeaa9176002041 Rengarajan S 2023-12-15  365  		if (*data_empty_count - UART_BURST_SIZE < 0)
eeaa9176002041 Rengarajan S 2023-12-15  366  			break;
eeaa9176002041 Rengarajan S 2023-12-15  367  		if (xmit->tail > (UART_XMIT_SIZE - UART_BURST_SIZE))
eeaa9176002041 Rengarajan S 2023-12-15  368  			break;
eeaa9176002041 Rengarajan S 2023-12-15  369  		writel(*(unsigned int *)&xmit->buf[xmit->tail],
eeaa9176002041 Rengarajan S 2023-12-15  370  		       port->membase + UART_TX_BURST_FIFO);
eeaa9176002041 Rengarajan S 2023-12-15  371  		*valid_byte_count -= UART_BURST_SIZE;
eeaa9176002041 Rengarajan S 2023-12-15  372  		*data_empty_count -= UART_BURST_SIZE;
eeaa9176002041 Rengarajan S 2023-12-15  373  		xmit->tail = (xmit->tail + UART_BURST_SIZE) &
eeaa9176002041 Rengarajan S 2023-12-15  374  			     (UART_XMIT_SIZE - 1);
eeaa9176002041 Rengarajan S 2023-12-15  375  	}
eeaa9176002041 Rengarajan S 2023-12-15  376  
eeaa9176002041 Rengarajan S 2023-12-15  377  	while (*valid_byte_count--) {
eeaa9176002041 Rengarajan S 2023-12-15  378  		if (*data_empty_count - UART_BYTE_SIZE < 0)
eeaa9176002041 Rengarajan S 2023-12-15  379  			break;
eeaa9176002041 Rengarajan S 2023-12-15  380  		writeb(xmit->buf[xmit->tail], port->membase +
eeaa9176002041 Rengarajan S 2023-12-15  381  		       UART_TX_BYTE_FIFO);
eeaa9176002041 Rengarajan S 2023-12-15  382  		*data_empty_count -= UART_BYTE_SIZE;
eeaa9176002041 Rengarajan S 2023-12-15  383  
eeaa9176002041 Rengarajan S 2023-12-15  384  		/*
eeaa9176002041 Rengarajan S 2023-12-15  385  		 * When the tail of the circular buffer is reached, the next
eeaa9176002041 Rengarajan S 2023-12-15  386  		 * byte is transferred to the beginning of the buffer.
eeaa9176002041 Rengarajan S 2023-12-15  387  		 */
eeaa9176002041 Rengarajan S 2023-12-15  388  		xmit->tail = (xmit->tail + UART_BYTE_SIZE) &
eeaa9176002041 Rengarajan S 2023-12-15  389  			     (UART_XMIT_SIZE - 1);
eeaa9176002041 Rengarajan S 2023-12-15  390  
eeaa9176002041 Rengarajan S 2023-12-15  391  		/*
eeaa9176002041 Rengarajan S 2023-12-15  392  		 * If there are any pending burst count, data is handled by
eeaa9176002041 Rengarajan S 2023-12-15  393  		 * transmitting DWORDs at a time.
eeaa9176002041 Rengarajan S 2023-12-15  394  		 */
eeaa9176002041 Rengarajan S 2023-12-15 @395  		if (valid_burst_count && (xmit->tail <
                                                            ^^^^^^^^^^^^^^^^^
So this test should be if valid_burst_count != -1.  Or if
valid_burst_count != UINT_MAX because it's unsigned...

eeaa9176002041 Rengarajan S 2023-12-15  396  		   (UART_XMIT_SIZE - UART_BURST_SIZE)))
eeaa9176002041 Rengarajan S 2023-12-15  397  			break;
eeaa9176002041 Rengarajan S 2023-12-15  398  	}
eeaa9176002041 Rengarajan S 2023-12-15  399  }

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


      reply	other threads:[~2024-01-02 14:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 15:11 [PATCH v1 tty-next 0/4] 8250: microchip: Burst Mode Support for PCI1XXXX Rengarajan S
2023-12-15 15:11 ` [PATCH v1 tty-next 1/4] 8250: microchip: pci1xxxx: Rearranging the structure declarations Rengarajan S
2023-12-15 15:11 ` [PATCH v1 tty-next 2/4] 8250: microchip: pci1xxxx: Add Syslock support for reading UART system registers Rengarajan S
2023-12-15 15:11 ` [PATCH v1 tty-next 3/4] 8250: microchip: pci1xxxx: Add Burst mode reception support in uart driver for writing into FIFO Rengarajan S
2023-12-15 15:11 ` [PATCH v1 tty-next 4/4] 8250: microchip: pci1xxxx: Add Burst mode transmission support in uart driver for reading from FIFO Rengarajan S
2024-01-02 14:06   ` Dan Carpenter [this message]

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=5d46ad8f-6537-4c53-8a81-85dca7bfbd9e@suswa.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=jirislaby@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kumaravel.thiagarajan@microchip.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=rengarajan.s@microchip.com \
    --cc=tharunkumar.pasumarthi@microchip.com \
    --cc=unglinuxdriver@microchip.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®