usb_midi: Fix an error when unpluging a MIDI device
- It appears that, in this case, port->open_fd is NULL.
Maybe, this would require some investigation too.
But in this case, i think it is better to remove port
from the device list anyway because remove_port will freed
the port at the end of the loop.
And adding 0xdeadbeef in the device list is not a good idea.
Change-Id: Id6b55f5e19ebbbbb48f0fa0b7d9ac65b996dbaf2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1746
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -464,8 +464,8 @@ usb_midi_removed(void* cookie)
|
|||||||
break;
|
break;
|
||||||
midiDevice->ports[cable] = NULL;
|
midiDevice->ports[cable] = NULL;
|
||||||
DPRINTF_DEBUG((MY_ID "removing port %d\n", cable));
|
DPRINTF_DEBUG((MY_ID "removing port %d\n", cable));
|
||||||
|
remove_port_info(port);
|
||||||
if (port->open_fd != NULL) {
|
if (port->open_fd != NULL) {
|
||||||
remove_port_info(port);
|
|
||||||
port->open_fd->port = NULL;
|
port->open_fd->port = NULL;
|
||||||
port->open_fd->device = NULL;
|
port->open_fd->device = NULL;
|
||||||
delete_sem(port->open_fd->sem_cb);
|
delete_sem(port->open_fd->sem_cb);
|
||||||
|
|||||||
Reference in New Issue
Block a user