Skip to content

Commit

Permalink
[media] tm6000: check an allocation for failure
Browse files Browse the repository at this point in the history
This allocation had no error checking.  It didn't need to be under
the mutex so I moved it out form there. That makes the error handling
easier and is a potential speed up.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Feb 8, 2013
1 parent de03277 commit 88b404c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/media/usb/tm6000/tm6000-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ int tm6000_read_write_usb(struct tm6000_core *dev, u8 req_type, u8 req,
u8 *data = NULL;
int delay = 5000;

mutex_lock(&dev->usb_lock);

if (len)
if (len) {
data = kzalloc(len, GFP_KERNEL);
if (!data)
return -ENOMEM;
}

mutex_lock(&dev->usb_lock);

if (req_type & USB_DIR_IN)
pipe = usb_rcvctrlpipe(dev->udev, 0);
Expand Down

0 comments on commit 88b404c

Please sign in to comment.