Re: [PATCH V8 04/10] USB: f81232: implement read IIR/MSR with endpoint

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

 



Hello,

Johan Hovold 於 2015/3/16 下午 04:55 寫道:
On Mon, Mar 16, 2015 at 11:08:29AM +0800, Peter Hung wrote:
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.

It's looks more readable of the style that you mentioned.
Thanks for your advice, I'll add it with next patch.

--
With Best Regards,
Peter Hung
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux