From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753559AbbCPJSS (ORCPT ); Mon, 16 Mar 2015 05:18:18 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:35716 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753334AbbCPJSP (ORCPT ); Mon, 16 Mar 2015 05:18:15 -0400 Message-ID: <55069FD3.2080807@gmail.com> Date: Mon, 16 Mar 2015 17:18:11 +0800 From: Peter Hung User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Johan Hovold CC: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, tom_tsai@fintek.com.tw, peter_hong@fintek.com.tw, Peter Hung Subject: Re: [PATCH V8 04/10] USB: f81232: implement read IIR/MSR with endpoint References: <1424944936-7117-1-git-send-email-hpeter+linux_kernel@gmail.com> <1424944936-7117-5-git-send-email-hpeter+linux_kernel@gmail.com> <20150314120231.GD9442@localhost> <5506492D.70001@gmail.com> <20150316085501.GB14918@localhost> In-Reply-To: <20150316085501.GB14918@localhost> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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