From: Hans de Goede <hdegoede@redhat.com>
To: Antonio Ospite <ospite@studenti.unina.it>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
Julia.Lawall@lip6.fr
Subject: Fwd: question about drivers/media/usb/gspca/kinect.c
Date: Thu, 26 Dec 2013 17:38:09 +0100 [thread overview]
Message-ID: <52BC5B71.5000308@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1312251956490.2020@localhost6.localdomain6>
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@lip6.fr>
To: hdegoede@redhat.com, m.chehab@samsung.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
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
next prev parent reply other threads:[~2013-12-26 16:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-25 19:00 question about drivers/media/usb/gspca/kinect.c Julia Lawall
2013-12-26 16:38 ` Hans de Goede [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52BC5B71.5000308@redhat.com \
--to=hdegoede@redhat.com \
--cc=Julia.Lawall@lip6.fr \
--cc=linux-media@vger.kernel.org \
--cc=ospite@studenti.unina.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox