Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp535583imm; Wed, 15 Aug 2018 01:22:39 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwbc98oK4yShcKHfqWa83fvypXG6NwP0yPS5iIMflOyV8I4vYFfIl5u3FKrz8qF9o1MbvND X-Received: by 2002:a62:20f:: with SMTP id 15-v6mr27038052pfc.100.1534321359245; Wed, 15 Aug 2018 01:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534321359; cv=none; d=google.com; s=arc-20160816; b=nh3B4RAw0Mo27972JLC0q5YbRygCbW1ZGWfRENoffOlxWkyS2424R1QAtiEj4WljiZ rxr8+tR1ofNKhc8wzfXtsYHTRRT96MkDcqVHV/Sq7tQymwrBgM3q+ezSS9MD1IfxNwqO TubT3r7or11Nb92XXZpuQZCFWPoP9KntICtGCOXVeHxzpPbGVqiuKcg/CjXSh93OBrDw diH8bvE/A93XaXhFcANK6mqceDWunbHFchVw8Pnt0BHHwiew3LdXOvU/RwuRsTHp88Yl DQnLlJR3nfhXWftwcfsB/NVAyMugUn00KUP0pVR1MFulFNZOWIt0KgzcrbYDj/eRgFaY Vv8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=gZwR/bl1EYlDt3Kyo0sbOzkO9n+MtPEUYuakEAcmF08=; b=xKombWQcblezfGoytsX9AVmZJ+irsj936fYS/XJuO6Z651tSQNye0Qy3yFoAtLSf4W xiPlay12MayZUEd3RwyHdiPxqIiJzd9GvoIczkL3yByq3LqPZRV/jaj+PTwq20fV3tqv WlwRXUgWnw63KnQh7KW3EEsx4/016tm+SUURHKkqxtuti1JKO6usJ02neF0tK/NALdLi t9Qr3l59fTVihotnhtNucD/LpED66rAPQaJHky02KVVm8kluxmKRAnqNSm53dxKZbu/Q QD2IuJGrmtwSwz1k9TQsPAs4OFVrCCKh0lES1PUJcMWwKHl6k2tDru0l7c5Wp8U9mSfx x1sQ== 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 t89-v6si24412114pfe.59.2018.08.15.01.22.23; Wed, 15 Aug 2018 01:22:39 -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 S1728668AbeHOLML (ORCPT + 99 others); Wed, 15 Aug 2018 07:12:11 -0400 Received: from mail.bootlin.com ([62.4.15.54]:47613 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726000AbeHOLML (ORCPT ); Wed, 15 Aug 2018 07:12:11 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 7FB5420802; Wed, 15 Aug 2018 10:20:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [78.250.39.94]) by mail.bootlin.com (Postfix) with ESMTPSA id 2837920723; Wed, 15 Aug 2018 10:20:56 +0200 (CEST) Date: Wed, 15 Aug 2018 10:20:55 +0200 From: Alexandre Belloni To: zhong jiang Cc: a.zummo@towertech.it, baruch@tkos.co.il, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] rtc:rtc-digicolor: Use PTR_ERR_OR_ZERO to replace the open code Message-ID: <20180815082055.GV943@piout.net> References: <1534159885-25364-1-git-send-email-zhongjiang@huawei.com> <1534159885-25364-2-git-send-email-zhongjiang@huawei.com> <20180814161541.GP943@piout.net> <5B73D368.5010205@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5B73D368.5010205@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/08/2018 15:16:56+0800, zhong jiang wrote: > On 2018/8/15 0:15, Alexandre Belloni wrote: > > Hi, > > > > On 13/08/2018 19:31:24+0800, zhong jiang wrote: > >> PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So > >> just replace them rather than duplicating its implement. > >> > >> Signed-off-by: zhong jiang > >> --- > >> drivers/rtc/rtc-digicolor.c | 4 +--- > >> 1 file changed, 1 insertion(+), 3 deletions(-) > >> > >> diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c > >> index b253bf1..fd6850c 100644 > >> --- a/drivers/rtc/rtc-digicolor.c > >> +++ b/drivers/rtc/rtc-digicolor.c > >> @@ -202,10 +202,8 @@ static int __init dc_rtc_probe(struct platform_device *pdev) > >> platform_set_drvdata(pdev, rtc); > >> rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name, > >> &dc_rtc_ops, THIS_MODULE); > >> - if (IS_ERR(rtc->rtc_dev)) > >> - return PTR_ERR(rtc->rtc_dev); > >> > >> - return 0; > >> + return PTR_ERR_OR_ZERO(rtc->rtc_dev); > > As many other maintainers, I don't find that kind of change useful and > > I'm not taking them unless there are other improvements in the driver. > > > > > Hi, Alexandre > > The issue is detected with the help of Coccinelle. It simplify the code with specific > function rather than duplicating its implementation. > > The patch clean up the code. of course, it is not a bug. if you do not care about it. > I am ok with that. > But this does not simplify or make the code clearer and as soon as you need to add code between the devm_rtc_device_register call and the end of the function, the patch will need to be undone. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com