Skip to contentSkip to conversation

mbim driver: call the release function in case MBIM OPEN fails

PATCH In review Giacinto Cifelli 2 participants 5 messages Sep 20, 2018 – Sep 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbim driver: call the release function in case MBIM OPEN fails

---
 drivers/mbimmodem/mbim.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mbimmodem/mbim.c +3 -0
index 9fcf44b..f4132d0 100644
@@ -781,6 +781,9 @@ static bool open_read_handler(struct l_io *io, void *user_data)
 	/* Grab OPEN_DONE Status field */
 	if (l_get_le32(buf) != 0) {
 		close(fd);
+		if (device->disconnect_handler)
+			device->disconnect_handler(device->ready_data);
+		device->is_ready = false;
 		return false;
 	}
 
Signature · 1 line
1.9.1
#1 lore raw

Hi Giacinto,

An actual description of what is happening would be helpful

Quoted 9 lines · Giacinto Cifelli
---
  drivers/mbimmodem/mbim.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/mbimmodem/mbim.c +0 -0
index 9fcf44b..f4132d0 100644

drivers/mbimmodem/mbim.c static bool open_read_handler(struct l_io *io, void *user_data) · line 786

Quoted 6 lines
drivers/mbimmodem/mbim.c +3 -0
@@ -781,6 +781,9 @@ static bool open_read_handler(struct l_io *io, void *user_data)
  	/* Grab OPEN_DONE Status field */
  	if (l_get_le32(buf) != 0) {
  		close(fd);
+		if (device->disconnect_handler)
+			device->disconnect_handler(device->ready_data);
+		device->is_ready = false;

I don't get this part. So device->is_ready = false assignment is pointless. It is already false.

Also, aren't we going to call device->disconnect_handler anyway by virtue of closing the fd? l_io_set_disconnect_handler which we set in mbim_device_new should already be taking care of this.

Regards,
-Denis

#2 lore raw

Hi Denis,

Quoted 9 lines · Denis Kenzior

Hi Giacinto,

An actual description of what is happening would be helpful

Quoted 4 lines · Giacinto Cifelli
---
  drivers/mbimmodem/mbim.c | 3 +++
  1 file changed, 3 insertions(+)
Quoted 15 lines

drivers/mbimmodem/mbim.c static bool open_read_handler(struct l_io *io, void

Quoted 5 lines
drivers/mbimmodem/mbim.c +0 -0
index 9fcf44b..f4132d0 100644
@@ -781,6 +781,9 @@ static bool open_read_handler(struct l_io *io, void

*user_data)

Quoted 6 lines
drivers/mbimmodem/mbim.c +3 -0
      /* Grab OPEN_DONE Status field */
      if (l_get_le32(buf) != 0) {
              close(fd);
+             if (device->disconnect_handler)
+                     device->disconnect_handler(device->ready_data);
+             device->is_ready = false

I don't get this part. So device->is_ready = false assignment is

Quoted 7 lines

pointless. It is already false.

Also, aren't we going to call device->disconnect_handler anyway by virtue of closing the fd? l_io_set_disconnect_handler which we set in mbim_device_new should already be taking care of this.

I will check about the is_ready false, but definitely the disconnect_handler is not called, I can tell you,
because on a special condition I have received a OPEN DONE with failure, and the driver remained hanging.
However, after calling it, there is a second call to disconnect_handler, but not if it is not done here.
Maybe the code should be verified somewhere else? Any other suggestions?

Regards,

Quoted 2 lines

-Denis

Regards,
Giacinto

#3 lore raw

Hi Giacinto,

Quoted 7 lines

I will check about the is_ready false, but definitely the disconnect_handler is not called, I can tell you,
because on a special condition I have received a OPEN DONE with failure, and the driver remained hanging.
However, after calling it, there is a second call to disconnect_handler, but not if it is not done here.
Maybe the code should be verified somewhere else? Any other suggestions?

Okay, I played with this a bit and indeed there was an issue. It should be fixed in ell upstream now.

See commit 0294175cff974ae9aae93e3609c5f6502db410ee.

Regards,
-Denis

#4 lore raw

Hi Denis,

Quoted 10 lines · Denis Kenzior

Hi Giacinto,

Quoted 7 lines

I will check about the is_ready false, but definitely the disconnect_handler is not called, I can tell you,
because on a special condition I have received a OPEN DONE with failure, and the driver remained hanging.
However, after calling it, there is a second call to disconnect_handler, but not if it is not done here.
Maybe the code should be verified somewhere else? Any other suggestions?

Quoted 5 lines

Okay, I played with this a bit and indeed there was an issue. It should be fixed in ell upstream now.

See commit 0294175cff974ae9aae93e3609c5f6502db410ee.

It works with this ell patch, and the disconnect_handler is called once. Thank you very much.

Quoted 4 lines

Regards,
-Denis

Regards,
Giacinto