Skip to content

Commit

Permalink
usbtest: comment on why this code "expects" negative and positive errnos
Browse files Browse the repository at this point in the history
On Mon, May 12, 2008 at 01:02:22AM -0700, David Brownell wrote:
> On Sunday 11 May 2008, Marcin Slusarz wrote:
> > 
> > test_ctrl_queue expects (?) positive and negative errnos.
> > what is going on here?
> 
> The sign is just a way to flag something:
> 
>                 /* some faults are allowed, not required */
> 
> The negative ones are required.  Positive codes are optional,
> in the sense that, depending on how the peripheral happens
> to be implemented, they won't necessarily be triggered.
> 
> For example, the test to fetch a device qualifier desriptor
> must succeed if the device is running at high speed.  So that
> test is marked as negative.  But when it's full speed, it
> could legitimately fail; marked as positive.  And so on for
> other tests.
> 
> Look at how the codes are *interpreted* to see it work.

Lets document it.

Based on comment from David Brownell <david-b@pacbell.net>.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Marcin Slusarz authored and Greg Kroah-Hartman committed May 14, 2008
1 parent 5fc8939 commit 6def755
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/usb/misc/usbtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,11 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
struct urb *u;
struct usb_ctrlrequest req;
struct subcase *reqp;

/* sign of this variable means:
* -: tested code must return this (negative) error code
* +: tested code may return this (negative too) error code
*/
int expected = 0;

/* requests here are mostly expected to succeed on any
Expand Down

0 comments on commit 6def755

Please sign in to comment.