All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tcan4x5x: clear MRAM before entering Normal mode
@ 2021-02-26 16:34 Torin Cooper-Bennun
  2021-02-28  8:35 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Torin Cooper-Bennun @ 2021-02-26 16:34 UTC (permalink / raw)
  To: linux-can; +Cc: dmurphy, mkl, 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 <torin@maxiluxsystems.com>
---
 drivers/net/can/m_can/tcan4x5x-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
index b7caec769ddb..4147cecfbbd6 100644
--- a/drivers/net/can/m_can/tcan4x5x-core.c
+++ b/drivers/net/can/m_can/tcan4x5x-core.c
@@ -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;
 }
 
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tcan4x5x: clear MRAM before entering Normal mode
  2021-02-26 16:34 [PATCH] tcan4x5x: clear MRAM before entering Normal mode Torin Cooper-Bennun
@ 2021-02-28  8:35 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2021-02-28  8:35 UTC (permalink / raw)
  To: Torin Cooper-Bennun; +Cc: linux-can, dmurphy

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

On 26.02.2021 16:34:41, Torin Cooper-Bennun wrote:
> 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 <torin@maxiluxsystems.com>

I've added a Fixed: tag and applied the patch to linux-can/testing.

Thanks,
Marc

-- 
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 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-28  8:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 16:34 [PATCH] tcan4x5x: clear MRAM before entering Normal mode Torin Cooper-Bennun
2021-02-28  8:35 ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.