usb: gadget: fix check in sync read from ep in gadgetfs

When reading synchronously from a non-zero endpoint, gadgetfs will
return -EFAULT even if the read succeeds, due to a bad check of the
copy_to_iter() return value.

This fix compares the return value of copy_to_iter to the amount of
bytes that was passed, and only fails if they are not the same.

Signed-off-by: Binyamin Sharet <s.binyamin@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
1 file changed