diff mbox series

[net,11/15] can: tcan4x5x: tcan4x5x_can_remove(): fix order of deregistration

Message ID 20201115174131.2089251-12-mkl@pengutronix.de
State New
Headers show
Series [net,01/15] can: af_can: prevent potential access of uninitialized member in can_rcv() | expand

Commit Message

Marc Kleine-Budde Nov. 15, 2020, 5:41 p.m. UTC
Change the order in tcan4x5x_can_remove() to be the exact inverse of
tcan4x5x_can_probe(). First m_can_class_unregister(), then power down the
device.

Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
Cc: Dan Murphy <dmurphy@ti.com>
Link: http://lore.kernel.org/r/20201019154233.1262589-10-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/tcan4x5x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dan Murphy Nov. 17, 2020, 2 p.m. UTC | #1
Marc

On 11/15/20 11:41 AM, Marc Kleine-Budde wrote:
> Change the order in tcan4x5x_can_remove() to be the exact inverse of

> tcan4x5x_can_probe(). First m_can_class_unregister(), then power down the

> device.

>

> Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel")

> Cc: Dan Murphy <dmurphy@ti.com>

> Link: http://lore.kernel.org/r/20201019154233.1262589-10-mkl@pengutronix.de

> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

> ---

>   drivers/net/can/m_can/tcan4x5x.c | 4 ++--

>   1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c

> index f058bd9104e9..4fdb7121403a 100644

> --- a/drivers/net/can/m_can/tcan4x5x.c

> +++ b/drivers/net/can/m_can/tcan4x5x.c

> @@ -527,10 +527,10 @@ static int tcan4x5x_can_remove(struct spi_device *spi)

>   {

>   	struct tcan4x5x_priv *priv = spi_get_drvdata(spi);

>   

> -	tcan4x5x_power_enable(priv->power, 0);

> -

>   	m_can_class_unregister(priv->mcan_dev);

>   

> +	tcan4x5x_power_enable(priv->power, 0);

> +

>   	return 0;

>   }

>   


Reviewed-by: Dan Murphy<dmurphy@ti.com>
Marc Kleine-Budde Nov. 17, 2020, 2:02 p.m. UTC | #2
On 11/17/20 3:00 PM, Dan Murphy wrote:
> Reviewed-by: Dan Murphy<dmurphy@ti.com>


Thanks. The patches are already mainline.

regards,
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 |
diff mbox series

Patch

diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c
index f058bd9104e9..4fdb7121403a 100644
--- a/drivers/net/can/m_can/tcan4x5x.c
+++ b/drivers/net/can/m_can/tcan4x5x.c
@@ -527,10 +527,10 @@  static int tcan4x5x_can_remove(struct spi_device *spi)
 {
 	struct tcan4x5x_priv *priv = spi_get_drvdata(spi);
 
-	tcan4x5x_power_enable(priv->power, 0);
-
 	m_can_class_unregister(priv->mcan_dev);
 
+	tcan4x5x_power_enable(priv->power, 0);
+
 	return 0;
 }