Fwd: question about drivers/media/usb/gspca/kinect.c

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

 



Hi,

Forwarding this to Antonio, the author of the kinect driver, who is
the best person to answer this.

Regards,

Hans



-------- Original Message --------
Subject: question about drivers/media/usb/gspca/kinect.c
Date: Wed, 25 Dec 2013 20:00:34 +0100 (CET)
From: Julia Lawall <julia.lawall@xxxxxxx>
To: hdegoede@xxxxxxxxxx, m.chehab@xxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx,        linux-kernel@xxxxxxxxxxxxxxx

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


--
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