Skip to contentSkip to conversation

net: can: etas_es58x: full cleanup in the error case

PATCH In review Oliver Neukum 2 participants 3 messages Feb 10 – Feb 11

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: can: etas_es58x: full cleanup in the error case

Memory allocation can fail in the middle. Hence the cleanup needs to be called in every case.

Fixes 8537257874e94 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/can/usb/etas_es58x/es58x_core.c +2 -1
index 2d248deb69dc..19fa51821a89 100644
@@ -1783,8 +1783,9 @@ static int es58x_open(struct net_device *netdev)
 
 	if (!es58x_dev->opened_channel_cnt) {
 		ret = es58x_alloc_rx_urbs(es58x_dev);
+		/* can fail partially */
 		if (ret)
-			return ret;
+			goto free_urbs;
 
 		ret = es58x_set_realtime_diff_ns(es58x_dev);
 		if (ret)
Signature · 1 line
2.53.0
#2 lore raw

Hi,

sorry for missing your last mail.

Quoted 10 lines · Vincent Mailhol
Quoted 5 lines · Oliver Neukum

Memory allocation can fail in the middle. Hence the cleanup needs to be called in every case.

Fixes 8537257874e94 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")

Did you see my previous message?

https://lore.kernel.org/linux-can/CAMZ6Rq+TtQnA-vvmfKhRftOuXyxWOPNZ4uH5ObT884OLDZHyng@mail.gmail.com/

Nice. This is a definite improvement and solves
the issue, but I think it has issues. I will
send in a follow-up.

Regards
Oliver