aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2006-10-09 05:09:33 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-17 17:46:32 -0400
commit27d39e2627dc7493f554bc0549d8c63953762478 (patch)
tree17aa7627b203a897657472abaf3559a73ed4fa9d /drivers
parentf8ac232ad7388bfff680b26e84b3ac63889d1cea (diff)
usb devio: handle class_device_create() error
This patch adds missing class_device_create() error check, and makes notifier return NOTIFY_BAD. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/devio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 724822cac2b1..fed92be63b5e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1588,15 +1588,18 @@ const struct file_operations usbfs_device_file_operations = {
1588 .release = usbdev_release, 1588 .release = usbdev_release,
1589}; 1589};
1590 1590
1591static void usbdev_add(struct usb_device *dev) 1591static int usbdev_add(struct usb_device *dev)
1592{ 1592{
1593 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); 1593 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
1594 1594
1595 dev->class_dev = class_device_create(usb_device_class, NULL, 1595 dev->class_dev = class_device_create(usb_device_class, NULL,
1596 MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev, 1596 MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev,
1597 "usbdev%d.%d", dev->bus->busnum, dev->devnum); 1597 "usbdev%d.%d", dev->bus->busnum, dev->devnum);
1598 if (IS_ERR(dev->class_dev))
1599 return PTR_ERR(dev->class_dev);
1598 1600
1599 dev->class_dev->class_data = dev; 1601 dev->class_dev->class_data = dev;
1602 return 0;
1600} 1603}
1601 1604
1602static void usbdev_remove(struct usb_device *dev) 1605static void usbdev_remove(struct usb_device *dev)
@@ -1609,7 +1612,8 @@ static int usbdev_notify(struct notifier_block *self, unsigned long action,
1609{ 1612{
1610 switch (action) { 1613 switch (action) {
1611 case USB_DEVICE_ADD: 1614 case USB_DEVICE_ADD:
1612 usbdev_add(dev); 1615 if (usbdev_add(dev))
1616 return NOTIFY_BAD;
1613 break; 1617 break;
1614 case USB_DEVICE_REMOVE: 1618 case USB_DEVICE_REMOVE:
1615 usbdev_remove(dev); 1619 usbdev_remove(dev);