lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 22 Nov 2015 12:36:53 +0200
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	Dave Penkler <dpenkler@...il.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	peter.chen@...escale.com, teuniz@...il.com,
	USB <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls on
 an instrument

On Sun, Nov 22, 2015 at 10:51 AM, Dave Penkler <dpenkler@...il.com> wrote:
> On Wed, Nov 18, 2015 at 11:41:30AM +0200, Andy Shevchenko wrote:
>> On Wed, Nov 18, 2015 at 10:38 AM, Dave Penkler <dpenkler@...il.com> wrote:


>> > +       if (rv < 0) {
>> > +               dev_err(dev, "simple usb_control_msg failed %d\n", rv);
>> > +               goto exit;
>> > +       } else if (rv != 1) {
>> > +               dev_warn(dev, "simple usb_control_msg returned %d\n", rv);
>>
>> Actually here what king of results could be? 0? 2+? In all cases of
>> error you have to provide an error code.
>>
>
> We seem to be going round in circles here, last time you suggested to
> propagate the return value.

You didn't pay much attention to where I put my comment. You have few
branches depending on return value

1) negative, apparently an error code, should be propagated if nothing
specific to framework;
2) zero, what does it means?
3) one, seems the expected result when success, so, error code should be 0;
4) two, three, … non-negative numbers,see 2).

For my understanding 2) and 4) have to return what you initially had -EIO.

> The non-negative return is the number of bytes
> transferred which should be 1 unless there is some usb implementation
> flakiness happening. So I will go back to returning -EIO.

Yes, in *this* branch.

>
>> > +               goto exit;
>> > +       }
>> > +
>> > +       if (buffer[0] != USBTMC_STATUS_SUCCESS) {
>> > +               dev_err(dev, "simple control status returned %x\n", buffer[0]);
>> > +               rv = -EIO;
>> > +               goto exit;
>> > +       }
>> > +       rv = 0;
>> > +
>> > + exit:
>> > +       kfree(buffer);
>> > +       return rv;
>> > +}

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists