Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88b404c4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab
Browse files

[media] tm6000: check an allocation for failure



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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent de03277d
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -40,10 +40,13 @@ int tm6000_read_write_usb(struct tm6000_core *dev, u8 req_type, u8 req,
	u8	     *data = NULL;
	u8	     *data = NULL;
	int delay = 5000;
	int delay = 5000;


	mutex_lock(&dev->usb_lock);
	if (len) {

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

	mutex_lock(&dev->usb_lock);


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