diff mbox series

can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices

Message ID 20240930-m_can-cleanups-v1-1-001c579cdee4@pengutronix.de (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices | expand

Checks

Context Check Description
netdev/tree_selection success Series ignored based on subject

Commit Message

Marc Kleine-Budde Sept. 30, 2024, 5:45 p.m. UTC
In commit b382380c0d2d ("can: m_can: Add hrtimer to generate software
interrupt") support for IRQ-less devices was added. Instead of an
interrupt, the interrupt routine is called by a hrtimer-based polling
loop.

That patch forgot to change free_irq() to be only called for devices
with IRQs. Fix this, by calling free_irq() conditionally only if an
IRQ is available for the device (and thus has been requested
previously).

Fixes: b382380c0d2d ("can: m_can: Add hrtimer to generate software interrupt")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/m_can.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


---
base-commit: d505d3593b52b6c43507f119572409087416ba28
change-id: 20240930-m_can-cleanups-53ce4276f1b1

Best regards,

Comments

Simon Horman Oct. 1, 2024, 11:12 a.m. UTC | #1
On Mon, Sep 30, 2024 at 07:45:57PM +0200, Marc Kleine-Budde wrote:
> In commit b382380c0d2d ("can: m_can: Add hrtimer to generate software
> interrupt") support for IRQ-less devices was added. Instead of an
> interrupt, the interrupt routine is called by a hrtimer-based polling
> loop.
> 
> That patch forgot to change free_irq() to be only called for devices
> with IRQs. Fix this, by calling free_irq() conditionally only if an
> IRQ is available for the device (and thus has been requested
> previously).
> 
> Fixes: b382380c0d2d ("can: m_can: Add hrtimer to generate software interrupt")
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Simon Horman <horms@kernel.org>
Markus Schneider-Pargmann Oct. 1, 2024, 12:48 p.m. UTC | #2
On Mon, Sep 30, 2024 at 07:45:57PM GMT, Marc Kleine-Budde wrote:
> In commit b382380c0d2d ("can: m_can: Add hrtimer to generate software
> interrupt") support for IRQ-less devices was added. Instead of an
> interrupt, the interrupt routine is called by a hrtimer-based polling
> loop.
> 
> That patch forgot to change free_irq() to be only called for devices
> with IRQs. Fix this, by calling free_irq() conditionally only if an
> IRQ is available for the device (and thus has been requested
> previously).
> 
> Fixes: b382380c0d2d ("can: m_can: Add hrtimer to generate software interrupt")
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>

Best
Markus

> ---
>  drivers/net/can/m_can/m_can.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index a978b960f1f1e1e8273216ff330ab789d0fd6d51..16e9e7d7527d9762d73a7ec47940c73c0976e05d 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -1765,7 +1765,8 @@ static int m_can_close(struct net_device *dev)
>  	netif_stop_queue(dev);
>  
>  	m_can_stop(dev);
> -	free_irq(dev->irq, dev);
> +	if (dev->irq)
> +		free_irq(dev->irq, dev);
>  
>  	m_can_clean(dev);
>  
> 
> ---
> base-commit: d505d3593b52b6c43507f119572409087416ba28
> change-id: 20240930-m_can-cleanups-53ce4276f1b1
> 
> Best regards,
> -- 
> Marc Kleine-Budde <mkl@pengutronix.de>
> 
>
diff mbox series

Patch

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index a978b960f1f1e1e8273216ff330ab789d0fd6d51..16e9e7d7527d9762d73a7ec47940c73c0976e05d 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1765,7 +1765,8 @@  static int m_can_close(struct net_device *dev)
 	netif_stop_queue(dev);
 
 	m_can_stop(dev);
-	free_irq(dev->irq, dev);
+	if (dev->irq)
+		free_irq(dev->irq, dev);
 
 	m_can_clean(dev);