Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6354742ybp; Tue, 15 Oct 2019 13:40:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5MK9U70V8q7WbkrkKp/fYvZTKJ3sYt8ED6sDsoA7Uw5CAjBVWGPMh7mGC/VfNIiWId+nT X-Received: by 2002:a17:906:fad7:: with SMTP id lu23mr37168472ejb.211.1571172047434; Tue, 15 Oct 2019 13:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571172047; cv=none; d=google.com; s=arc-20160816; b=koX8D3Rbsf5+hXzDvplfwp/z6c5UB3f4/tLaKjN4PBBt7JS8jyqiYkUvuAwJjQ3La4 fHl3095/92huN2BCydvEr9vu8WWnCKCzECW3WP9ltaHKCYQ8+QJ32Ef20wQoqy/iugZE pi62y/eVVw4D17FmvVZ4xY+SzWD1dqj/QiqW5C4ybda1Px4/uCMDr3TVApWd6FkT2VIg i2JAqMKKJ2uwq5/rcqVImurVnS0Oue3o6edo9i2yrZ+w9jEphN2hvZfGLuQbsw70RDVP sWWMnv6uqXATDqI/KYQDagtkzgO9wSkNvNae3/DaGH2ghkEw9xn9F7zrCTFVrhy2Dq+v nP8A== 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; bh=rwZrigMYm4L+8+uNSecOnJxiVK0fu6NgBjDW1krzhoE=; b=DWh9nGUotLYXQapPuptjzWt9jrzYitwN667tPHIwrgG2syxpZqayC8/Xq3V29E4qSp QqGyQ0rmxfDZkg303xoqG/l7QoHJqBMMT4uOxmvM7vY4Jp6Ge7J8eIyDMCpZo1jrBZfJ aM49ODmE+nEWikeOd0EDiyFM7kwrl5da4nMM4Nc0Qd1ykOAv+4rK+w7E6C1tKsirCRBa 6gADlIA1ttGtRfJVxuQFCOW6N0pnN2nyg45FdZRRIpNhMZaybfAs1cw5hg+NDDCm/NJ0 eBurT96lID+QWA+5LdFFCr0WHP2dmJ2GTgA1SzHixZf+v0ugY7uiYvCXMpkN+96oILch 2lBA== 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 d13si13976983edx.156.2019.10.15.13.40.23; Tue, 15 Oct 2019 13:40:47 -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 S1728398AbfJOQ4x (ORCPT + 99 others); Tue, 15 Oct 2019 12:56:53 -0400 Received: from foss.arm.com ([217.140.110.172]:43382 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfJOQ4w (ORCPT ); Tue, 15 Oct 2019 12:56:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D4DFA337; Tue, 15 Oct 2019 09:56:51 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (unknown [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B74A23F68E; Tue, 15 Oct 2019 09:56:49 -0700 (PDT) Date: Tue, 15 Oct 2019 17:56:47 +0100 From: Lorenzo Pieralisi To: Markus Elfring Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, Binghui Wang , Bjorn Helgaas , Jingoo Han , Kevin Hilman , Krzysztof Kozlowski , Kukjin Kim , Yue Wang , Xiaowei Song , LKML , kernel-janitors@vger.kernel.org, YueHaibing , zhong jiang Subject: Re: [PATCH] PCI: dwc: Use PTR_ERR_OR_ZERO() in five functions Message-ID: <20191015165647.GD25674@e121166-lin.cambridge.arm.com> References: <95c9dfae-af81-82ad-e989-1fdf5f29808e@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <95c9dfae-af81-82ad-e989-1fdf5f29808e@web.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 06, 2019 at 08:50:07PM +0200, Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 6 Sep 2019 20:40:06 +0200 > > Simplify these function implementations by using a known function. > > Generated by: scripts/coccinelle/api/ptr_ret.cocci > > Signed-off-by: Markus Elfring > --- > drivers/pci/controller/dwc/pci-exynos.c | 5 +---- > drivers/pci/controller/dwc/pci-meson.c | 10 ++-------- > drivers/pci/controller/dwc/pcie-kirin.c | 10 ++-------- > 3 files changed, 5 insertions(+), 20 deletions(-) https://lore.kernel.org/linux-pci/20190527140952.GB7202@ulmo/ Dropped, sorry. Lorenzo > diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c > index cee5f2f590e2..b6ab1cc5d895 100644 > --- a/drivers/pci/controller/dwc/pci-exynos.c > +++ b/drivers/pci/controller/dwc/pci-exynos.c > @@ -92,10 +92,7 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev, > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > ep->mem_res->elbi_base = devm_ioremap_resource(dev, res); > - if (IS_ERR(ep->mem_res->elbi_base)) > - return PTR_ERR(ep->mem_res->elbi_base); > - > - return 0; > + return PTR_ERR_OR_ZERO(ep->mem_res->elbi_base); > } > > static int exynos5440_pcie_get_clk_resources(struct exynos_pcie *ep) > diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c > index e35e9eaa50ee..713059918002 100644 > --- a/drivers/pci/controller/dwc/pci-meson.c > +++ b/drivers/pci/controller/dwc/pci-meson.c > @@ -182,10 +182,7 @@ static int meson_pcie_get_mems(struct platform_device *pdev, > > /* Meson SoC has two PCI controllers use same phy register*/ > mp->mem_res.phy_base = meson_pcie_get_mem_shared(pdev, mp, "phy"); > - if (IS_ERR(mp->mem_res.phy_base)) > - return PTR_ERR(mp->mem_res.phy_base); > - > - return 0; > + return PTR_ERR_OR_ZERO(mp->mem_res.phy_base); > } > > static void meson_pcie_power_on(struct meson_pcie *mp) > @@ -259,10 +256,7 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp) > return PTR_ERR(res->general_clk); > > res->clk = meson_pcie_probe_clock(dev, "pcie", 0); > - if (IS_ERR(res->clk)) > - return PTR_ERR(res->clk); > - > - return 0; > + return PTR_ERR_OR_ZERO(res->clk); > } > > static inline void meson_elb_writel(struct meson_pcie *mp, u32 val, u32 reg) > diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c > index c19617a912bd..75b1f1dde747 100644 > --- a/drivers/pci/controller/dwc/pcie-kirin.c > +++ b/drivers/pci/controller/dwc/pcie-kirin.c > @@ -138,10 +138,7 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie, > return PTR_ERR(kirin_pcie->apb_sys_clk); > > kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk"); > - if (IS_ERR(kirin_pcie->pcie_aclk)) > - return PTR_ERR(kirin_pcie->pcie_aclk); > - > - return 0; > + return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk); > } > > static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie, > @@ -174,10 +171,7 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie, > > kirin_pcie->sysctrl = > syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl"); > - if (IS_ERR(kirin_pcie->sysctrl)) > - return PTR_ERR(kirin_pcie->sysctrl); > - > - return 0; > + return PTR_ERR_OR_ZERO(kirin_pcie->sysctrl); > } > > static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie) > -- > 2.23.0 >