diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2024-09-09 15:07:41 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2024-09-12 09:45:54 +0200 |
commit | 2c09b50efcad985cf920ca88baa9aa52b1999dcc (patch) | |
tree | 7e73c6d5a3138a77ef9255422cc6aba68f3c34fe /drivers/net/can | |
parent | 801ad2f87b0c6d0c34a75a4efd6bfd3a2d9f9298 (diff) | |
download | linux-2c09b50efcad985cf920ca88baa9aa52b1999dcc.tar.gz linux-2c09b50efcad985cf920ca88baa9aa52b1999dcc.tar.bz2 linux-2c09b50efcad985cf920ca88baa9aa52b1999dcc.zip |
can: m_can: m_can_close(): stop clocks after device has been shut down
After calling m_can_stop() an interrupt may be pending or NAPI might
still be executed. This means the driver might still touch registers
of the IP core after the clocks have been disabled. This is not good
practice and might lead to aborts depending on the SoC integration.
To avoid these potential problems, make m_can_close() symmetric to
m_can_open(), i.e. stop the clocks at the end, right before shutting
down the transceiver.
Fixes: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support")
Link: https://patch.msgid.link/20240910-can-m_can-fix-ifup-v3-2-6c1720ba45ce@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/m_can/m_can.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index c1a07013433e..7fec04b024d5 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1764,7 +1764,6 @@ static int m_can_close(struct net_device *dev) netif_stop_queue(dev); m_can_stop(dev); - m_can_clk_stop(cdev); free_irq(dev->irq, dev); m_can_clean(dev); @@ -1779,6 +1778,7 @@ static int m_can_close(struct net_device *dev) close_candev(dev); + m_can_clk_stop(cdev); phy_power_off(cdev->transceiver); return 0; |