From: Torin Cooper-Bennun <torin@maxiluxsystems.com>
To: linux-can@vger.kernel.org
Cc: dmurphy@ti.com, mkl@pengutronix.de,
Torin Cooper-Bennun <torin@maxiluxsystems.com>
Subject: [PATCH] tcan4x5x: clear MRAM before entering Normal mode
Date: Fri, 26 Feb 2021 16:34:41 +0000 [thread overview]
Message-ID: <20210226163440.313628-1-torin@maxiluxsystems.com> (raw)
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
next reply other threads:[~2021-02-26 16:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 16:34 Torin Cooper-Bennun [this message]
2021-02-28 8:35 ` [PATCH] tcan4x5x: clear MRAM before entering Normal mode Marc Kleine-Budde
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=20210226163440.313628-1-torin@maxiluxsystems.com \
--to=torin@maxiluxsystems.com \
--cc=dmurphy@ti.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
/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 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.