aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2007-07-15 15:59:22 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-15 19:40:51 -0400
commit53b67950026ee642b43615f46df22ec3d36b4a53 (patch)
tree91ca8baa1c95c4ce4dc50adbdc4f89478be1c289 /drivers/usb
parent8d9107e8c50e1c4ff43c91c8841805833f3ecfb9 (diff)
minimal fixes for drivers/usb/gadget/m66592-udc.c
still looks racy (and definitely leaks) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/m66592-udc.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index c0a962bb5f25..0174a322e007 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -937,6 +937,7 @@ static void get_status(struct m66592 *m66592, struct usb_ctrlrequest *ctrl)
937 *m66592->ep0_buf = status; 937 *m66592->ep0_buf = status;
938 m66592->ep0_req->buf = m66592->ep0_buf; 938 m66592->ep0_req->buf = m66592->ep0_buf;
939 m66592->ep0_req->length = 2; 939 m66592->ep0_req->length = 2;
940 /* AV: what happens if we get called again before that gets through? */
940 m66592_queue(m66592->gadget.ep0, m66592->ep0_req, GFP_KERNEL); 941 m66592_queue(m66592->gadget.ep0, m66592->ep0_req, GFP_KERNEL);
941} 942}
942 943
@@ -1254,24 +1255,6 @@ static void m66592_free_request(struct usb_ep *_ep, struct usb_request *_req)
1254 kfree(req); 1255 kfree(req);
1255} 1256}
1256 1257
1257static void *m66592_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
1258 dma_addr_t *dma, gfp_t gfp_flags)
1259{
1260 void *buf;
1261
1262 buf = kzalloc(bytes, gfp_flags);
1263 if (dma)
1264 *dma = virt_to_bus(buf);
1265
1266 return buf;
1267}
1268
1269static void m66592_free_buffer(struct usb_ep *_ep, void *buf,
1270 dma_addr_t dma, unsigned bytes)
1271{
1272 kfree(buf);
1273}
1274
1275static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req, 1258static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req,
1276 gfp_t gfp_flags) 1259 gfp_t gfp_flags)
1277{ 1260{
@@ -1378,9 +1361,6 @@ static struct usb_ep_ops m66592_ep_ops = {
1378 .alloc_request = m66592_alloc_request, 1361 .alloc_request = m66592_alloc_request,
1379 .free_request = m66592_free_request, 1362 .free_request = m66592_free_request,
1380 1363
1381 .alloc_buffer = m66592_alloc_buffer,
1382 .free_buffer = m66592_free_buffer,
1383
1384 .queue = m66592_queue, 1364 .queue = m66592_queue,
1385 .dequeue = m66592_dequeue, 1365 .dequeue = m66592_dequeue,
1386 1366
@@ -1603,11 +1583,12 @@ static int __init m66592_probe(struct platform_device *pdev)
1603 1583
1604 the_controller = m66592; 1584 the_controller = m66592;
1605 1585
1586 /* AV: leaks */
1606 m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); 1587 m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL);
1607 if (m66592->ep0_req == NULL) 1588 if (m66592->ep0_req == NULL)
1608 goto clean_up; 1589 goto clean_up;
1609 m66592->ep0_buf = m66592_alloc_buffer(&m66592->ep[0].ep, 2, NULL, 1590 /* AV: leaks, and do we really need it separately allocated? */
1610 GFP_KERNEL); 1591 m66592->ep0_buf = kzalloc(2, GFP_KERNEL);
1611 if (m66592->ep0_buf == NULL) 1592 if (m66592->ep0_buf == NULL)
1612 goto clean_up; 1593 goto clean_up;
1613 1594