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

Marc Kleine-Budde posted 1 patch 1 month, 4 weeks ago
drivers/net/can/m_can/m_can.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH can-next] can: mcan: m_can_open(): simplify condition to call free_irq()
Posted by Marc Kleine-Budde 1 month, 4 weeks ago
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(-)

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)

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

Best regards,
-- 
Marc Kleine-Budde <mkl@pengutronix.de>
Re: [PATCH can-next] can: mcan: m_can_open(): simplify condition to call free_irq()
Posted by Simon Horman 1 month, 4 weeks ago
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>