public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* question about drivers/media/usb/gspca/kinect.c
@ 2013-12-25 19:00 Julia Lawall
  2013-12-26 16:38 ` Fwd: " Hans de Goede
  2013-12-30 15:56 ` Antonio Ospite
  0 siblings, 2 replies; 6+ messages in thread
From: Julia Lawall @ 2013-12-25 19:00 UTC (permalink / raw)
  To: hdegoede, m.chehab, linux-media, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-23 21:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 19:00 question about drivers/media/usb/gspca/kinect.c Julia Lawall
2013-12-26 16:38 ` Fwd: " Hans de Goede
2013-12-30 15:56 ` Antonio Ospite
2013-12-30 16:41   ` [PATCH 1/2] gspca_kinect: fix kinect_read() error path Antonio Ospite
2014-02-23 21:45     ` Hans de Goede
2013-12-30 16:41   ` [PATCH 2/2] gspca_kinect: fix messages about kinect_read() return value Antonio Ospite

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox