usb_packet_set_state: handle p->ep == NULL
usb_packet_set_state can be called with p->ep = NULL. The tracepoint there tries to log endpoint information, which leads to a segfault. This patch makes usb_packet_set_state handle the NULL pointer properly. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
39c2057700
commit
f5bf14bf39
@ -484,12 +484,17 @@ void usb_packet_check_state(USBPacket *p, USBPacketState expected)
|
||||
|
||||
void usb_packet_set_state(USBPacket *p, USBPacketState state)
|
||||
{
|
||||
USBDevice *dev = p->ep->dev;
|
||||
USBBus *bus = usb_bus_from_device(dev);
|
||||
|
||||
trace_usb_packet_state_change(bus->busnr, dev->port->path, p->ep->nr, p,
|
||||
usb_packet_state_name(p->state),
|
||||
usb_packet_state_name(state));
|
||||
if (p->ep) {
|
||||
USBDevice *dev = p->ep->dev;
|
||||
USBBus *bus = usb_bus_from_device(dev);
|
||||
trace_usb_packet_state_change(bus->busnr, dev->port->path, p->ep->nr, p,
|
||||
usb_packet_state_name(p->state),
|
||||
usb_packet_state_name(state));
|
||||
} else {
|
||||
trace_usb_packet_state_change(-1, "", -1, p,
|
||||
usb_packet_state_name(p->state),
|
||||
usb_packet_state_name(state));
|
||||
}
|
||||
p->state = state;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user