Thread (6 messages) 6 messages, 2 authors, 2021-02-05

[PATCH 2/2] can: m_can: m_can_class_allocate_dev(): remove impossible error return judgment

flat view
STALE2085d LANDED

From: Xulin Sun <hidden>
Date: 2021-02-05 07:28:38
Also in: linux-can, lkml
Subsystem: can network drivers, mcan device driver, the rest · Maintainers: Marc Kleine-Budde, Vincent Mailhol, Markus Schneider-Pargmann, Linus Torvalds

Landed in mainline as 8fa12201b652 on 2021-03-30.

If the previous can_net device has been successfully allocated, its
private data structure is impossible to be empty, remove this redundant
error return judgment. Otherwise, memory leaks for alloc_candev() will
be triggered.

Signed-off-by: Xulin Sun <redacted>
---
 drivers/net/can/m_can/m_can.c | 5 -----
 1 file changed, 5 deletions(-)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 02c5795b7393..042940088d41 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1797,11 +1797,6 @@ struct m_can_classdev *m_can_class_allocate_dev(struct device *dev)
 	}
 
 	class_dev = netdev_priv(net_dev);
-	if (!class_dev) {
-		dev_err(dev, "Failed to init netdev cdevate");
-		goto out;
-	}
-
 	class_dev->net = net_dev;
 	class_dev->dev = dev;
 	SET_NETDEV_DEV(net_dev, dev);
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help