public inbox for linux-can@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: can: etas_es58x: full cleanup in the error case
@ 2026-01-13 10:27 Oliver Neukum
  2026-01-13 11:00 ` Vincent Mailhol
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2026-01-13 10:27 UTC (permalink / raw)
  To: mailhol, mkl, linux-can; +Cc: Oliver Neukum

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

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index f799233c2b72..8a8764374713 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -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)
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: can: etas_es58x: full cleanup in the error case
  2026-01-13 10:27 [PATCH] net: can: etas_es58x: full cleanup in the error case Oliver Neukum
@ 2026-01-13 11:00 ` Vincent Mailhol
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Mailhol @ 2026-01-13 11:00 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: mkl, linux-can

On Tue. 13 Jan. 2026 à 11:29, Oliver Neukum <oneukum@suse.com> wrote:
> Memory allocation can fail in the middle. Hence the cleanup
> needs to be called in every case.
>
> Signed-off-by: Oliver Neukum <oneukum@suse.com>

Have you seen this:

  commit b1979778e985 ("can: etas_es58x: allow partial RX URB
allocation to succeed")
  Link: https://git.kernel.org/netdev/net/c/b1979778e985

?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] net: can: etas_es58x: full cleanup in the error case
@ 2026-02-10 14:50 Oliver Neukum
  2026-02-10 19:07 ` Vincent Mailhol
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2026-02-10 14:50 UTC (permalink / raw)
  To: mailhol, mkl, linux-can; +Cc: 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")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 2d248deb69dc..19fa51821a89 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -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)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: can: etas_es58x: full cleanup in the error case
  2026-02-10 14:50 Oliver Neukum
@ 2026-02-10 19:07 ` Vincent Mailhol
  2026-02-11 10:32   ` Oliver Neukum
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Mailhol @ 2026-02-10 19:07 UTC (permalink / raw)
  To: Oliver Neukum, mkl, linux-can

On 10/02/2026 at 15:50, Oliver Neukum wrote:
> 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")
> Signed-off-by: Oliver Neukum <oneukum@suse.com>

Did you see my previous message?

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

Yours sincerely,
Vincent Mailhol


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: can: etas_es58x: full cleanup in the error case
  2026-02-10 19:07 ` Vincent Mailhol
@ 2026-02-11 10:32   ` Oliver Neukum
  0 siblings, 0 replies; 5+ messages in thread
From: Oliver Neukum @ 2026-02-11 10:32 UTC (permalink / raw)
  To: Vincent Mailhol, mkl, linux-can

Hi,

sorry for missing your last mail.

On 10.02.26 20:07, Vincent Mailhol wrote:
> On 10/02/2026 at 15:50, Oliver Neukum wrote:
>> 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")
>> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> 
> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-11 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13 10:27 [PATCH] net: can: etas_es58x: full cleanup in the error case Oliver Neukum
2026-01-13 11:00 ` Vincent Mailhol
  -- strict thread matches above, loose matches on Subject: below --
2026-02-10 14:50 Oliver Neukum
2026-02-10 19:07 ` Vincent Mailhol
2026-02-11 10:32   ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox