From patchwork Thu Apr 9 19:32:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 6190131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 33F369F2EC for ; Thu, 9 Apr 2015 19:34:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AB582037E for ; Thu, 9 Apr 2015 19:34:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73C472037B for ; Thu, 9 Apr 2015 19:34:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YgICH-00030r-HT; Thu, 09 Apr 2015 19:33:05 +0000 Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YgICA-0002tl-SV for linux-arm-kernel@lists.infradead.org; Thu, 09 Apr 2015 19:32:59 +0000 Received: by oblw8 with SMTP id w8so147646079obl.0 for ; Thu, 09 Apr 2015 12:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=8z15T4za7a4pWOMb0n/KRasyxtjZM0Dx+UlKVkKmqUg=; b=KRXTluPcGe2o8po2FUsEd55iVpQbtreeL6pQTVUig4bY6uqtsldgDJcStchs3DdmXX d30PEWCeiu46RJ9Sg944u/tXef5jk8bskdBgNuVf7cxSjVCxxo8HLDNuYhr8Qy2PiHp/ 7idZNGbbYtua3Ru2CYu7Zp9/tX+sWxa8PftcpYTHWhbqkhTwnpx7DNdSi7JvXNvXS7Ud khvxoaxanhTaI/hMy3QBtzpgGUpYNb7UHbFGxPaTih00ENyq0985v85rUJo4HVHFHhZ2 VOi2wPozZszv1lePsfswgDEMDe3e0JlRJP3ladrmJaQ6LDbCOoTGuPV1PcyDSoCXRvo9 vQeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=8z15T4za7a4pWOMb0n/KRasyxtjZM0Dx+UlKVkKmqUg=; b=U2Lu+AlbFifVNFAIY3hglnCnmGyFwt0ozcHdq6wfYd5A3k5YJEysPL7g+DYU+7Te9W dyK0JSJq+pb73S/GC4xFE9k8yCOb/ocot+vIhJUojSBcDLlme5MsUJ1vPv1RxtQUqE5i JzoRkNvaeanjGWR1Jan+DG9CbB2W4qxXgVVnH/1Kz4p1t1bubLGfme4dmgsOTxxLeb7k Z4msoNp2LwU8bBAOTK14JHoPW9D95uPca9jyQQ6nLf9h+6wo1zEoE5rAfeSeBq3gFAkK PO7OLOuXbnt3AOJJWcufswCFAH7/SdrkA5mbaDmHoFjb4gAZ5sSX/+a3TMI4i4w2VSrl Crhw== X-Gm-Message-State: ALoCoQk5cnupGxPrIkox1PSt3O42nAf2TDXYkQpPLzxnbyquF9phoNdUgRtlpxWBiMv9dMdBVH76 X-Received: by 10.182.230.132 with SMTP id sy4mr41074754obc.29.1428607957808; Thu, 09 Apr 2015 12:32:37 -0700 (PDT) Received: from google.com ([146.7.4.74]) by mx.google.com with ESMTPSA id co9sm12112301obb.22.2015.04.09.12.32.36 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 Apr 2015 12:32:37 -0700 (PDT) Date: Thu, 9 Apr 2015 14:32:32 -0500 From: Bjorn Helgaas To: Jisheng Zhang Subject: Re: [PATCH] PCI: versatile: don't check resource with devm_ioremap_resource Message-ID: <20150409193232.GK30967@google.com> References: <1428067025-543-1-git-send-email-jszhang@marvell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1428067025-543-1-git-send-email-jszhang@marvell.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150409_123258_990317_0DF505CA X-CRM114-Status: GOOD ( 13.77 ) X-Spam-Score: 3.5 (+++) Cc: robh@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FSL_HELO_FAKE, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Apr 03, 2015 at 09:17:05PM +0800, Jisheng Zhang wrote: > devm_ioremap_resource does sanity checks on the given resource. No need > to duplicate this in the driver. And we should check whether > devm_ioremap_resource() succeeds or not. > > This patch fixes all of these two trival issues. > > Signed-off-by: Jisheng Zhang This looks correct to me, so I applied it to pci/host-versatile for v4.1 (unless Rob chimes in). commit 873581698d391ff070fc1eb8fb298c85e873c07c Author: Jisheng Zhang Date: Fri Apr 3 21:17:05 2015 +0800 PCI: versatile: Check for devm_ioremap_resource() failures Check for failure of devm_ioremap_resource(). devm_ioremap_resource() validates the resource it receives, so if we check for devm_ioremap_resource() failure, we need not check for failure of the preceding platform_get_resource(). [bhelgaas: changelog] Signed-off-by: Jisheng Zhang Signed-off-by: Bjorn Helgaas diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c index 1ec694a52379..b1caaea740fe 100644 --- a/drivers/pci/host/pci-versatile.c +++ b/drivers/pci/host/pci-versatile.c @@ -138,19 +138,19 @@ static int versatile_pci_probe(struct platform_device *pdev) LIST_HEAD(pci_res); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; versatile_pci_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(versatile_pci_base)) + return PTR_ERR(versatile_pci_base); res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (!res) - return -ENODEV; versatile_cfg_base[0] = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(versatile_cfg_base[0])) + return PTR_ERR(versatile_cfg_base[0]); res = platform_get_resource(pdev, IORESOURCE_MEM, 2); - if (!res) - return -ENODEV; versatile_cfg_base[1] = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(versatile_cfg_base[1])) + return PTR_ERR(versatile_cfg_base[1]); ret = versatile_pci_parse_request_of_pci_ranges(&pdev->dev, &pci_res); if (ret)