tcan4x5x: clear MRAM before entering Normal mode
Subsystems (2)
PATCH 1/1 tcan4x5x: clear MRAM before entering Normal mode
This prevents a potentially destructive race condition. The device is fully operational on the bus after entering Normal mode, so zeroing the MRAM after entering this mode may lead to loss of information, e.g. new received messages.
Signed-off-by Torin Cooper-Bennun <[email protected]>
--- drivers/net/can/m_can/tcan4x5x-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/m_can/tcan4x5x-core.c +3 -3
@@ -237,14 +237,14 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)if (ret)return ret; +/* Zero out the MCAN buffers */ +m_can_init_ram (cdev); + ret =regmap_update_bits (tcan4x5x->regmap,TCAN4X5X_CONFIG ,TCAN4X5X_MODE_SEL_MASK ,TCAN4X5X_MODE_NORMAL );if (ret)return ret; -/* Zero out the MCAN buffers */ -m_can_init_ram (cdev); -return ret; }
Signature · 1 line
2.30.0
Marc Kleine-Budde
maintainerQuoted 6 lines · Torin Cooper-Bennun
This prevents a potentially destructive race condition. The device is fully operational on the bus after entering Normal mode, so zeroing the MRAM after entering this mode may lead to loss of information, e.g. new received messages.
Signed-off-by Torin Cooper-Bennun <[email protected]>
I've added a Fixed: tag and applied the patch to linux-can/testing.
Thanks,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |