lkml.org 
[lkml]   [2013]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectquestion about drivers/media/usb/gspca/kinect.c
The following code, in the function send_cmd, looks too concise:

do {
actual_len = kinect_read(udev, ibuf, 0x200);
} while (actual_len == 0);
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;
}

It seems that actual_len might be less than sizeof(*rhdr) either because
an error code is returned by the call to kinect_read or because a shorter
length is returned than the desired one. In the error code case, I would
guess that one would want to return the error code, but I don't know what
on would want to return in the other case. In any case, res is not
defined by this code, so what is returned is whatever the result of the
previous call to kinect_write happened to be.

How should the code be changed?

thanks,
julia


\
 
 \ /
  Last update: 2013-12-25 20:21    [W:0.079 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site