X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=inline;f=drivers%2Fusb%2Fcore%2Fdevices.c;h=aefc7987120d37bfa4d67c11bfb37f84b5dc18bc;hb=703071b5b93d88d5acb0edd5b9dd86c69ad970f2;hp=a47c30b2d7645cfc1cdde964a31753596961c5e1;hpb=fe6af6faec078ec8137631f24cb541f9918244f0;p=powerpc.git diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index a47c30b2d7..aefc798712 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 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 +611,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