* [patch] [media] tm6000: check an allocation for failure
@ 2013-01-30 7:03 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-01-30 7:03 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media, kernel-janitors
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>
diff --git a/drivers/media/usb/tm6000/tm6000-core.c b/drivers/media/usb/tm6000/tm6000-core.c
index 22cc011..7c32353 100644
--- a/drivers/media/usb/tm6000/tm6000-core.c
+++ b/drivers/media/usb/tm6000/tm6000-core.c
@@ -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);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-01-30 7:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-30 7:03 [patch] [media] tm6000: check an allocation for failure Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox