[PATCH 4.14 040/165] can: m_can: Move accessing of message ram to after clocks are enabled

From: Greg Kroah-Hartman
Date: Mon Sep 03 2018 - 13:17:14 EST


4.14-stable review patch. If anyone has any objections, please let me know.

------------------

From: Faiz Abbas <faiz_abbas@xxxxxx>

[ Upstream commit 54e4a0c486041dc1c20593d997fafd67089e8408 ]

MCAN message ram should only be accessed once clocks are enabled.
Therefore, move the call to parse/init the message ram to after
clocks are enabled.

Signed-off-by: Faiz Abbas <faiz_abbas@xxxxxx>
Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/can/m_can/m_can.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1637,8 +1637,6 @@ static int m_can_plat_probe(struct platf
priv->can.clock.freq = clk_get_rate(cclk);
priv->mram_base = mram_addr;

- m_can_of_parse_mram(priv, mram_config_vals);
-
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);

@@ -1649,6 +1647,8 @@ static int m_can_plat_probe(struct platf
goto failed_free_dev;
}

+ m_can_of_parse_mram(priv, mram_config_vals);
+
devm_can_led_init(dev);

dev_info(&pdev->dev, "%s device registered (irq=%d, version=%d)\n",
@@ -1698,8 +1698,6 @@ static __maybe_unused int m_can_resume(s

pinctrl_pm_select_default_state(dev);

- m_can_init_ram(priv);
-
priv->can.state = CAN_STATE_ERROR_ACTIVE;

if (netif_running(ndev)) {
@@ -1709,6 +1707,7 @@ static __maybe_unused int m_can_resume(s
if (ret)
return ret;

+ m_can_init_ram(priv);
m_can_start(ndev);
netif_device_attach(ndev);
netif_start_queue(ndev);