From: Sam Bishop <[EMAIL PROTECTED]> Prevents a compiler warning and uses down_interruptible() instead of down() in process context.
Signed-off-by: Sam Bishop <[EMAIL PROTECTED]> --- On Thu, Dec 22, 2005 at 03:10:02PM -0800, Greg KH wrote: > > Hm, Oliver beat you to this by a day and got his patch in my queue: > http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/... > > Sorry about that :( Perhaps I ought to subscribe to the list--I'd know about these things... :) Here are two more suggestions besides the change from max() to min() in Olav Kongas's patch: --- linux-2.6.14.4/drivers/usb/usb-skeleton.c.orig 2005-12-22 16:44:25.950289192 -0700 +++ linux-2.6.14.4/drivers/usb/usb-skeleton.c 2005-12-22 16:41:47.150430440 -0700 @@ -166,7 +166,7 @@ static ssize_t skel_write(struct file *f int retval = 0; struct urb *urb = NULL; char *buf = NULL; - size_t writesize = min(count, MAX_TRANSFER); + size_t writesize = min(count, (size_t)MAX_TRANSFER); dev = (struct usb_skel *)file->private_data; @@ -175,7 +175,10 @@ static ssize_t skel_write(struct file *f goto exit; /* limit the number of URBs in flight to stop a user from using up all RAM */ - down (&dev->limit_sem); + if (down_interruptible(&dev->limit_sem)) { + retval = -ERESTARTSYS; + goto exit; + } /* create a urb, and a buffer for it, and copy the data to the urb */ urb = usb_alloc_urb(0, GFP_KERNEL); ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel