]> git.baikalelectronics.ru Git - kernel.git/commit
can: m_can: m_can_fifo_{read,write}: don't read or write from/to FIFO if length is 0
authorMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 14 Jan 2022 14:35:01 +0000 (15:35 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 24 Jan 2022 17:27:43 +0000 (18:27 +0100)
commitdb72589c49fd260bfc99c7160c079675bc7417af
treec4ef412256eab6be9ffb8269b04a52a91fc4a47b
parent17a30422621c0e04cb6060d20d7edcefd7463347
can: m_can: m_can_fifo_{read,write}: don't read or write from/to FIFO if length is 0

In order to optimize FIFO access, especially on m_can cores attached
to slow busses like SPI, in patch

e39381770ec9 ("can: m_can: Disable IRQs on FIFO bus errors")

bulk read/write support has been added to the m_can_fifo_{read,write}
functions.

That change leads to the tcan driver to call
regmap_bulk_{read,write}() with a length of 0 (for CAN frames with 0
data length). regmap treats this as an error:

| tcan4x5x spi1.0 tcan4x5x0: FIFO write returned -22

This patch fixes the problem by not calling the
cdev->ops->{read,write)_fifo() in case of a 0 length read/write.

Fixes: e39381770ec9 ("can: m_can: Disable IRQs on FIFO bus errors")
Link: https://lore.kernel.org/all/20220114155751.2651888-1-mkl@pengutronix.de
Cc: stable@vger.kernel.org
Cc: Matt Kline <matt@bitbashing.io>
Cc: Chandrasekar Ramakrishnan <rcsekar@samsung.com>
Reported-by: Michael Anochin <anochin@photo-meter.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/m_can/m_can.c