Skip to content
  • Hans de Goede's avatar
    usb: kbd: On a "usb reset" call usb_kbd_deregister() before calling usb_stop() · 6e78c74f
    Hans de Goede authored
    
    
    We need to call usb_kbd_deregister() before calling usb_stop().
    
    usbkbd's stdio_dev->priv points to the usb_device, and usb_kbd_testc
    dereferences usb_device->privptr.
    
    usb_stop zeros usb_device, leaving usb_device->privptr NULL, causing
    bad things (tm) to happen once control returns to the main loop and
    usb_kbd_testc gets called.
    
    Calling usb_kbd_deregister() avoids this. Note that we do not allow
    the "usb reset" to continue when the deregister fails. This will be fixed
    in a later patch.
    
    For the same reasons always fail "usb stop" if the usb_kbd_deregister() fails,
    even in the force path. This can happen when CONFIG_SYS_STDIO_DEREGISTER is
    not set.
    
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    6e78c74f