diff --git a/hal/src/thumbv6m/usb/bus.rs b/hal/src/thumbv6m/usb/bus.rs index c718ada23248..d10d7ad738bc 100644 --- a/hal/src/thumbv6m/usb/bus.rs +++ b/hal/src/thumbv6m/usb/bus.rs @@ -979,19 +979,14 @@ impl Inner { bank.clear_received_setup_interrupt(); } - // self.print_epstatus(idx, "read"); - bank.clear_transfer_complete(); if buf.len() != 0 { bank.set_ready(false); } - drop(bank); - match size { Ok(size) => { - //dbgprint!("UsbBus::read {} bytes ok", size); dbgprint!( "UsbBus::read {} bytes from ep {:?} -> {:?}\n", size, @@ -1002,6 +997,7 @@ impl Inner { } Err(err) => { dbgprint!("UsbBus::read from ep {:?} -> {:?}\n", ep, err); + drop(bank); // bank holds a reference to self.desc, which print_epstatus() needs self.print_epstatus(ep.index(), "after read"); Err(err) } diff --git a/hal/src/thumbv7em/usb/bus.rs b/hal/src/thumbv7em/usb/bus.rs index 6f04f4184928..9c8f8461a8a8 100644 --- a/hal/src/thumbv7em/usb/bus.rs +++ b/hal/src/thumbv7em/usb/bus.rs @@ -925,19 +925,14 @@ impl Inner { bank.clear_received_setup_interrupt(); } - // self.print_epstatus(idx, "read"); - bank.clear_transfer_complete(); if buf.len() != 0 { bank.set_ready(false); } - drop(bank); - match size { Ok(size) => { - //dbgprint!("UsbBus::read {} bytes ok", size); dbgprint!( "UsbBus::read {} bytes from ep {:?} -> {:?}\n", size, @@ -948,6 +943,7 @@ impl Inner { } Err(err) => { dbgprint!("UsbBus::read from ep {:?} -> {:?}\n", ep, err); + drop(bank); // bank holds a reference to self.desc, which print_epstatus() needs self.print_epstatus(ep.index(), "after read"); Err(err) }