Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1863807ybx; Sat, 2 Nov 2019 07:47:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaNPHwrpwxHrWqmt5wH2/FnWRXRC5YmbiWAc4ebIW1rkcuVfjhsErh/cD1VP/lH+wMXTpV X-Received: by 2002:a50:ac14:: with SMTP id v20mr18975744edc.291.1572706022248; Sat, 02 Nov 2019 07:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572706022; cv=none; d=google.com; s=arc-20160816; b=UpK1gdEB1lls8NWB57BCrLItmaW8Ll1cXbBneuWZ1yk6sdV+dazQRs2S9MKGzGaTc3 0vv4PAInC7miNT2Xut1KDy/m31JtwDmTHbozy8/hupd2xG0ivTcBeiJinplyj7ATiSoY ZGq3Lz2iaNMA5nTHA7xEbMVR0qMWXeD8/TwHpXO7ldN/Z0+3gRSzn4I0UpSApbePL3tx qd4A/rGSLOn2S3KbYILeiT0bgoqXVGAsYSaOOpYrJ7S62UXtJPgbvq8+8nH6DaivjIno AuZCHBjXD82aSJPqo4yrCgoaqHlHikQL06maoV16c1Amj5cO+CGIy3EovhPjoVyPzto0 OUwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=UP65EC7ypgWNLyvo6H/VM2oUIHo9cHA2tRtNenkE0ys=; b=jLCcN05lDLSD4I1Y4Wo9A0okxEwtlCcULIpRUTM9usnlZyXM1gaMLHe2Wt2rgIPCei Igw0Q+YonHOYjmb/a3URAgtI6hsifgAA5mrWHH7PKTT1PMPlIfpx9NBPhL1lUgTXWfhO +Ql3JWuxzn9CArK8DPI4mTXMo3S7jI/+GR9v3CREvJFXb3BxBMfPWt3UcDI30XVrKOgo izWU3hzb8FudVMjy+mX335meVHCvJe3tDtyNUa6E5WffTa6FxF5DbObVDBFtRGP/jVj8 F0bhuCoMbk6QovrXGBKsYbdu4CU7qK2zh84TmLJOby3mCDgwzs0u59x//eOwabJ0eooo TRHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rk26si7733498ejb.303.2019.11.02.07.46.38; Sat, 02 Nov 2019 07:47:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726823AbfKBOp5 (ORCPT + 99 others); Sat, 2 Nov 2019 10:45:57 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:55844 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726437AbfKBOp5 (ORCPT ); Sat, 2 Nov 2019 10:45:57 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 570B72DBB41AF27810DD; Sat, 2 Nov 2019 22:45:54 +0800 (CST) Received: from [127.0.0.1] (10.133.219.218) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Sat, 2 Nov 2019 22:45:51 +0800 Message-ID: <5DBD969E.9010706@huawei.com> Date: Sat, 2 Nov 2019 22:45:50 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Maxime Ripard CC: , , , , Subject: Re: [PATCH] ASoC: sun4i: Use PTR_ERR_OR_ZERO to simplify the code References: <1572530979-27595-1-git-send-email-zhongjiang@huawei.com> <20191101091355.ibbet6a2zb23bpjn@hendrix> <5DBC1D3E.8080705@huawei.com> <20191101145343.4nazxxztj5sfcuxm@hendrix> In-Reply-To: <20191101145343.4nazxxztj5sfcuxm@hendrix> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.133.219.218] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/11/1 22:53, Maxime Ripard wrote: > On Fri, Nov 01, 2019 at 07:55:42PM +0800, zhong jiang wrote: >> On 2019/11/1 17:13, Maxime Ripard wrote: >>> On Thu, Oct 31, 2019 at 10:09:39PM +0800, zhong jiang wrote: >>>> It is better to use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR. >>>> >>>> Signed-off-by: zhong jiang >>>> --- >>>> sound/soc/sunxi/sun4i-i2s.c | 4 +--- >>>> 1 file changed, 1 insertion(+), 3 deletions(-) >>>> >>>> diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c >>>> index d0a8d58..72012a6 100644 >>>> --- a/sound/soc/sunxi/sun4i-i2s.c >>>> +++ b/sound/soc/sunxi/sun4i-i2s.c >>>> @@ -1174,10 +1174,8 @@ static int sun4i_i2s_init_regmap_fields(struct device *dev, >>>> i2s->field_fmt_sr = >>>> devm_regmap_field_alloc(dev, i2s->regmap, >>>> i2s->variant->field_fmt_sr); >>>> - if (IS_ERR(i2s->field_fmt_sr)) >>>> - return PTR_ERR(i2s->field_fmt_sr); >>>> >>>> - return 0; >>>> + return PTR_ERR_OR_ZERO(i2s->field_fmt_sr); >>> I don't find it "better". This couples the error handling and the >>> success case, and it makes it harder to extend in the future. >> PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR. It is >> feasible to replace it and more readable at least now. >> >> As you said, PTR_ERR_OR_ZERO should be removed ? :-( > No, I'm saying that in this context, this change isn't necessary. I am not an expert in the field. It depends on you. > Maxime