diff mbox series

[can-next] can: mcan: m_can_open(): simplify condition to call free_irq()

Message ID 20240930-m_can-simplify-v1-1-43312571c028@pengutronix.de (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [can-next] can: mcan: m_can_open(): simplify condition to call free_irq() | expand

Checks

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

Commit Message

Marc Kleine-Budde Sept. 30, 2024, 6:03 p.m. UTC
The condition to call free_irq() in the error cleanup path of
m_can_open() can be simplified. The "is_peripheral" case also has a
"dev->irq != 0".

Simplify the condition, call free_irq() if "dev->irq != 0", i.e. the
device has an interrupt.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/m_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: c824deb1a89755f70156b5cdaf569fca80698719
change-id: 20240930-m_can-simplify-f50760775f3b

Best regards,

Comments

Simon Horman Oct. 1, 2024, 11:12 a.m. UTC | #1
On Mon, Sep 30, 2024 at 08:03:46PM +0200, Marc Kleine-Budde wrote:
> The condition to call free_irq() in the error cleanup path of
> m_can_open() can be simplified. The "is_peripheral" case also has a
> "dev->irq != 0".
> 
> Simplify the condition, call free_irq() if "dev->irq != 0", i.e. the
> device has an interrupt.
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Simon Horman <horms@kernel.org>
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..66a8673e51eab8c901434de16c640045f7d0dd70 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -2070,7 +2070,7 @@  static int m_can_open(struct net_device *dev)
 	return 0;
 
 exit_start_fail:
-	if (cdev->is_peripheral || dev->irq)
+	if (dev->irq)
 		free_irq(dev->irq, dev);
 exit_irq_fail:
 	if (cdev->is_peripheral)