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:	Mon, 16 Mar 2015 09:55:01 +0100
From:	Johan Hovold <johan@...nel.org>
To:	Peter Hung <hpeter@...il.com>
Cc:	Johan Hovold <johan@...nel.org>, gregkh@...uxfoundation.org,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	tom_tsai@...tek.com.tw, peter_hong@...tek.com.tw,
	Peter Hung <hpeter+linux_kernel@...il.com>
Subject: Re: [PATCH V8 04/10] USB: f81232: implement read IIR/MSR with
 endpoint

On Mon, Mar 16, 2015 at 11:08:29AM +0800, Peter Hung wrote:
> Hello,
> 
> Johan Hovold 於 2015/3/14 下午 08:02 寫道:
> > On Thu, Feb 26, 2015 at 06:02:10PM +0800, Peter Hung wrote:
> >> +	if (status != sizeof(*val)) {
> >> +		dev_err(&port->dev, "%s failed status: %d\n", __func__, status);
> >> +
> >> +		if (status == 0)
> >> +			status = -EIO;
> >> +		else
> >> +			status = usb_translate_errors(status);
> >
> > Could you rewrite this as
> >
> > 	if (status < 0)
> > 		status = usb_translate_errors(status);
> > 	else
> > 		status = 0;
> 
> In my definition the return value of set/getregister(), 0 is success, 
> negative values are errors. The function usb_control_msg() return value 
> is success transmited/received byte. It's maybe return 0. I want to 
> treat 0 with error(-EIO). But if pass 0 to usb_translate_errors(), It 
> will return 0 back. So I need especially handle with status == 0.

I meant to write

	if (status < 0)
 		status = usb_translate_errors(status);
	else
		status = -EIO;

which I think is more readable.

Sorry for the confusion.

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ