[PATCH 1/2] gspca_kinect: fix kinect_read() error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The error checking code relative to the invocations of kinect_read()
does not return the actual return code of the function just called, it
returns "res" which still contains the value of the last invocation of
a previous kinect_write().

Return the proper value, and while at it also report with -EREMOTEIO the
case of a partial transfer.

Reported-by: Julia Lawall <julia.lawall@xxxxxxx>
Signed-off-by: Antonio Ospite <ospite@xxxxxxxxxxxxxxxxx>
---
 drivers/media/usb/gspca/kinect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/gspca/kinect.c b/drivers/media/usb/gspca/kinect.c
index 3773a8a..48084736 100644
--- a/drivers/media/usb/gspca/kinect.c
+++ b/drivers/media/usb/gspca/kinect.c
@@ -158,7 +158,7 @@ static int send_cmd(struct gspca_dev *gspca_dev, uint16_t cmd, void *cmdbuf,
 	PDEBUG(D_USBO, "Control reply: %d", res);
 	if (actual_len < sizeof(*rhdr)) {
 		pr_err("send_cmd: Input control transfer failed (%d)\n", res);
-		return res;
+		return actual_len < 0 ? actual_len : -EREMOTEIO;
 	}
 	actual_len -= sizeof(*rhdr);
 
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux