aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/inode.c
diff options
context:
space:
mode:
authorMilan Svoboda <msvoboda@ra.rockwell.com>2006-06-26 10:19:00 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 14:58:52 -0400
commit8a7471aba19dc526978a03bfe2e3c122712b5900 (patch)
treecc78b29c2b0118a805197c8d143188a4a4e1ea8a /drivers/usb/gadget/inode.c
parent07cb7f23d07aa4d197dbeb123eb9719c176190ee (diff)
USB: fix ep_config to return correct value
This patch fixes ep_config to return correct value. Without patch ep_config returns submitted lenght minus 4 on succes. With this patch applied, whole submitted lenght is returned. ep_config parses submitted data and if buffer starts with (int) 1 it is parsed, otherwise error is reported. Problem is that ep_config returns size of buffer minus 4 on success. I think that size of buffer should be returned instead, because there were no problems and all data were processed. Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/inode.c')
-rw-r--r--drivers/usb/gadget/inode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index da85732fa993..72c88aa94d5d 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -741,7 +741,7 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
741 struct ep_data *data = fd->private_data; 741 struct ep_data *data = fd->private_data;
742 struct usb_ep *ep; 742 struct usb_ep *ep;
743 u32 tag; 743 u32 tag;
744 int value; 744 int value, length = len;
745 745
746 if ((value = down_interruptible (&data->lock)) < 0) 746 if ((value = down_interruptible (&data->lock)) < 0)
747 return value; 747 return value;
@@ -792,7 +792,6 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
792 goto fail0; 792 goto fail0;
793 } 793 }
794 } 794 }
795 value = len;
796 795
797 spin_lock_irq (&data->dev->lock); 796 spin_lock_irq (&data->dev->lock);
798 if (data->dev->state == STATE_DEV_UNBOUND) { 797 if (data->dev->state == STATE_DEV_UNBOUND) {
@@ -822,8 +821,10 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
822 data->name); 821 data->name);
823 data->state = STATE_EP_DEFER_ENABLE; 822 data->state = STATE_EP_DEFER_ENABLE;
824 } 823 }
825 if (value == 0) 824 if (value == 0) {
826 fd->f_op = &ep_io_operations; 825 fd->f_op = &ep_io_operations;
826 value = length;
827 }
827gone: 828gone:
828 spin_unlock_irq (&data->dev->lock); 829 spin_unlock_irq (&data->dev->lock);
829 if (value < 0) { 830 if (value < 0) {