Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: usbip: clean up mixed use of _irq() and _irqsave()

It generally doesn't make sense to use _irq() and _irqsave() in the same
function because either some of the callers have disabled IRQs or they
haven't. In this case, the v_recv_cmd_submit() appears to always be
called with IRQs enabled so the code works fine. That means I could
convert it to either _irq() or _irqsave() but I chose to use _irqsave()
because it's more conservative and easier to review.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Yo4gqLPtHO6XKMLn@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
ecf6dedd df22ecc4

+3 -3
+3 -3
drivers/usb/usbip/vudc_rx.c
··· 104 104 if (pdu->base.direction == USBIP_DIR_IN) 105 105 address |= USB_DIR_IN; 106 106 107 - spin_lock_irq(&udc->lock); 107 + spin_lock_irqsave(&udc->lock, flags); 108 108 urb_p->ep = vudc_find_endpoint(udc, address); 109 109 if (!urb_p->ep) { 110 110 /* we don't know the type, there may be isoc data! */ 111 111 dev_err(&udc->pdev->dev, "request to nonexistent endpoint"); 112 - spin_unlock_irq(&udc->lock); 112 + spin_unlock_irqrestore(&udc->lock, flags); 113 113 usbip_event_add(&udc->ud, VUDC_EVENT_ERROR_TCP); 114 114 ret = -EPIPE; 115 115 goto free_urbp; 116 116 } 117 117 urb_p->type = urb_p->ep->type; 118 - spin_unlock_irq(&udc->lock); 118 + spin_unlock_irqrestore(&udc->lock, flags); 119 119 120 120 urb_p->new = 1; 121 121 urb_p->seqnum = pdu->base.seqnum;