patch-2.4.0-test11 linux/drivers/usb/devio.c
Next file: linux/drivers/usb/dsbr100.c
Previous file: linux/drivers/usb/dc2xx.c
Back to the patch index
Back to the overall index
- Lines: 72
- Date:
Sun Nov 12 20:45:19 2000
- Orig file:
v2.4.0-test10/linux/drivers/usb/devio.c
- Orig date:
Tue Oct 31 12:42:27 2000
diff -u --recursive --new-file v2.4.0-test10/linux/drivers/usb/devio.c linux/drivers/usb/devio.c
@@ -292,7 +292,8 @@
* interface claiming
*/
-static void *driver_probe(struct usb_device *dev, unsigned int intf)
+static void *driver_probe(struct usb_device *dev, unsigned int intf,
+ const struct usb_device_id *id)
{
return NULL;
}
@@ -541,13 +542,17 @@
i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.request, ctrl.requesttype,
ctrl.value, ctrl.index, tbuf, ctrl.length, tmo);
if ((i > 0) && ctrl.length) {
- if (copy_to_user(ctrl.data, tbuf, ctrl.length))
+ if (copy_to_user(ctrl.data, tbuf, ctrl.length)) {
+ free_page((unsigned long)tbuf);
return -EFAULT;
+ }
}
} else {
if (ctrl.length) {
- if (copy_from_user(tbuf, ctrl.data, ctrl.length))
+ if (copy_from_user(tbuf, ctrl.data, ctrl.length)) {
+ free_page((unsigned long)tbuf);
return -EFAULT;
+ }
}
i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.request, ctrl.requesttype,
ctrl.value, ctrl.index, tbuf, ctrl.length, tmo);
@@ -583,7 +588,7 @@
return -EINVAL;
len1 = bulk.len;
if (len1 > PAGE_SIZE)
- len1 = PAGE_SIZE;
+ return -EINVAL;
if (!(tbuf = (unsigned char *)__get_free_page(GFP_KERNEL)))
return -ENOMEM;
tmo = (bulk.timeout * HZ + 999) / 1000;
@@ -594,13 +599,17 @@
}
i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
if (!i && len2) {
- if (copy_to_user(bulk.data, tbuf, len2))
+ if (copy_to_user(bulk.data, tbuf, len2)) {
+ free_page((unsigned long)tbuf);
return -EFAULT;
+ }
}
} else {
if (len1) {
- if (copy_from_user(tbuf, bulk.data, len1))
+ if (copy_from_user(tbuf, bulk.data, len1)) {
+ free_page((unsigned long)tbuf);
return -EFAULT;
+ }
}
i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
}
@@ -697,9 +706,11 @@
continue;
if (intf->driver) {
+ const struct usb_device_id *id;
down(&intf->driver->serialize);
intf->driver->disconnect(ps->dev, intf->private_data);
- intf->driver->probe(ps->dev, i);
+ id = usb_match_id(ps->dev,intf,intf->driver->id_table);
+ intf->driver->probe(ps->dev, i, id);
up(&intf->driver->serialize);
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)