]> err.no Git - linux-2.6/blobdiff - drivers/usb/core/devices.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[linux-2.6] / drivers / usb / core / devices.c
index a47c30b2d7645cfc1cdde964a31753596961c5e1..6753ca059ee43808fbbeb0128d27ae54ab56687c 100644 (file)
@@ -246,7 +246,6 @@ static char *usb_dump_interface_descriptor(char *start, char *end,
 
        if (start > end)
                return start;
-       down_read(&usb_bus_type.subsys.rwsem);
        if (iface) {
                driver_name = (iface->dev.driver
                                ? iface->dev.driver->name
@@ -263,7 +262,6 @@ static char *usb_dump_interface_descriptor(char *start, char *end,
                         desc->bInterfaceSubClass,
                         desc->bInterfaceProtocol,
                         driver_name);
-       up_read(&usb_bus_type.subsys.rwsem);
        return start;
 }
 
@@ -604,10 +602,6 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
        lock_kernel();
        if (!st) {
                st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL);
-               if (!st) {
-                       unlock_kernel();
-                       return POLLIN;
-               }
 
                /* we may have dropped BKL - need to check for having lost the race */
                if (file->private_data) {
@@ -615,6 +609,11 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
                        st = file->private_data;
                        goto lost_race;
                }
+               /* we haven't lost - check for allocation failure now */
+               if (!st) {
+                       unlock_kernel();
+                       return POLLIN;
+               }
 
                /*
                 * need to prevent the module from being unloaded, since