summaryrefslogtreecommitdiff
path: root/drivers/staging/most
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2020-05-27 11:06:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-27 12:24:46 +0200
commit8bf56cfafac12de3087633470b25cada5bdfc7aa (patch)
tree77d9901782bc401befc09075048fa9546c0c04c1 /drivers/staging/most
parent2c069b61a843dc9c3d2296b54c4baa9730286530 (diff)
staging: most: usb: move allocation of URB out of critical section
This patch puts the call to usb_alloc_urb() before the critical section starts that is protected with the io_mutex lock. This is to make the section as short as possible and to use the regular GFP_KERNEL flag. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/1590570387-27069-6-git-send-email-christian.gromm@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r--drivers/staging/most/usb/usb.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index a605e0f2028a..534825fc064c 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -467,18 +467,16 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
if (iface->num_channels <= channel || channel < 0)
return -ECHRNG;
+ urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_KERNEL);
+ if (!urb)
+ return -ENOMEM;
+
conf = &mdev->conf[channel];
mutex_lock(&mdev->io_mutex);
if (!mdev->usb_device) {
retval = -ENODEV;
- goto unlock_io_mutex;
- }
-
- urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_ATOMIC);
- if (!urb) {
- retval = -ENOMEM;
- goto unlock_io_mutex;
+ goto err_free_urb;
}
if ((conf->direction & MOST_CH_TX) && mdev->padding_active[channel] &&