[haiku-commits] haiku: hrev53431 - src/add-ons/kernel/drivers/midi/usb_midi

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 30 Aug 2019 15:21:11 -0400 (EDT)

hrev53431 adds 1 changeset to branch 'master'
old head: df6cc9b5c923e79d19c96e84eaf755676691e4ed
new head: fea647905ffbb7650c1f7c1c12852184a2606e19
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=fea647905ffb+%5Edf6cc9b5c923

----------------------------------------------------------------------------

fea647905ffb: 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 <waddlesplash@xxxxxxxxx>

                                   [ oco27 <olivier.coursiere@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53431
Commit:      fea647905ffbb7650c1f7c1c12852184a2606e19
URL:         https://git.haiku-os.org/haiku/commit/?id=fea647905ffb
Author:      oco27 <olivier.coursiere@xxxxxxxxxxx>
Date:        Sun Aug 25 14:45:14 2019 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Fri Aug 30 19:21:09 2019 UTC

----------------------------------------------------------------------------

1 file changed, 1 insertion(+), 1 deletion(-)
src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp | 2 +-

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp 
b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp
index 589905ef93..5656fec2c8 100644
--- a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp
+++ b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp
@@ -464,8 +464,8 @@ usb_midi_removed(void* cookie)
                        break;
                midiDevice->ports[cable] = NULL;
                DPRINTF_DEBUG((MY_ID "removing port %d\n", cable));
+               remove_port_info(port);
                if (port->open_fd != NULL) {
-                       remove_port_info(port);
                        port->open_fd->port = NULL;
                        port->open_fd->device = NULL;
                        delete_sem(port->open_fd->sem_cb);


Other related posts:

  • » [haiku-commits] haiku: hrev53431 - src/add-ons/kernel/drivers/midi/usb_midi - Adrien Destugues