aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2007-01-25 05:22:24 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-16 18:32:17 -0500
commit6957e1ac9c498ff934eaf1b7591b5ea1c98b6e54 (patch)
tree4d02721f6f0b376a8f6fe084647acebfe6f79d2b /drivers/usb
parentc5999f0da73b7f46435a67671c8861ed14a94c4e (diff)
USB: fix needless failure under certain conditions
in devices.c we have a piece of code for dealing with losing in a race. If we indeed lose the race we don't care whether our own memory allocation worked. The check for that is so early that we return early even if we don't have to. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/devices.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index a47c30b2d764..aefc7987120d 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -604,10 +604,6 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
604 lock_kernel(); 604 lock_kernel();
605 if (!st) { 605 if (!st) {
606 st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL); 606 st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL);
607 if (!st) {
608 unlock_kernel();
609 return POLLIN;
610 }
611 607
612 /* we may have dropped BKL - need to check for having lost the race */ 608 /* we may have dropped BKL - need to check for having lost the race */
613 if (file->private_data) { 609 if (file->private_data) {
@@ -615,6 +611,11 @@ static unsigned int usb_device_poll(struct file *file, struct poll_table_struct
615 st = file->private_data; 611 st = file->private_data;
616 goto lost_race; 612 goto lost_race;
617 } 613 }
614 /* we haven't lost - check for allocation failure now */
615 if (!st) {
616 unlock_kernel();
617 return POLLIN;
618 }
618 619
619 /* 620 /*
620 * need to prevent the module from being unloaded, since 621 * need to prevent the module from being unloaded, since