From patchwork Sun Sep 27 16:47:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7273431 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 337B0BEEA4 for ; Sun, 27 Sep 2015 16:47:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 608D62078D for ; Sun, 27 Sep 2015 16:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7956620786 for ; Sun, 27 Sep 2015 16:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751033AbbI0Qrw (ORCPT ); Sun, 27 Sep 2015 12:47:52 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:37383 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750961AbbI0Qrv (ORCPT ); Sun, 27 Sep 2015 12:47:51 -0400 Received: by wicfx3 with SMTP id fx3so72824427wic.0 for ; Sun, 27 Sep 2015 09:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:cc:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=YTftLqA3bGCOluYdprFqJjF47ktv40QZ9JmSss6Mrnk=; b=Ia0BTx1YENDeYVyBBuiyT0aFYLZz+WfVzdQzs28NiQSZZX0/NmYqyqwVEBQlKYdxhT CyVvr3ZTh5Jk8pOvFwv6kOZo4jt6GvV2i0E8UE6fkqoOGZvRPJYt89mvxWM1H4ef6pd6 oMTjoxREUgsq/E1EiQOgjotrrAKzNuQvC0XnqwxmFWFnqI5Ri/66Enz+rfeOr4P3vtKC BxI7tw4SN+QNWLSUB+w7gP4V6jswDzjuJ2w/K6SagG7nlFxJv9XYCL5NFLalMw+rI+kE FAOT59IWlOF1X2Bgz0vdkBCy0ieSImoIp1R1M2gp91vFf1ZJodY5Z9I2yEBAR3PSPuAl 7XWg== X-Received: by 10.181.13.241 with SMTP id fb17mr13552581wid.45.1443372470468; Sun, 27 Sep 2015 09:47:50 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:19e4:f8a2:3016:5bfd? (p200300625F33D30019E4F8A230165BFD.dip0.t-ipconnect.de. [2003:62:5f33:d300:19e4:f8a2:3016:5bfd]) by smtp.googlemail.com with ESMTPSA id 12sm13906995wjw.15.2015.09.27.09.47.49 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Sep 2015 09:47:50 -0700 (PDT) To: Mark Brown From: Heiner Kallweit Subject: [PATCH] spi: ath79: simplify iomem resource mapping Cc: "linux-spi@vger.kernel.org" Message-ID: <56081DA7.4040305@gmail.com> Date: Sun, 27 Sep 2015 18:47:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Simplify the code by switching from devm_ioremap to devm_ioremap_resource. Checking the result of platform_get_resource is not needed as devm_ioremap_resource checks the provided resource argument for NULL. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-ath79.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index bf1f9b3..6165bf2 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c @@ -240,14 +240,9 @@ static int ath79_spi_probe(struct platform_device *pdev) sp->bitbang.flags = SPI_CS_HIGH; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (r == NULL) { - ret = -ENOENT; - goto err_put_master; - } - - sp->base = devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (!sp->base) { - ret = -ENXIO; + sp->base = devm_ioremap_resource(&pdev->dev, r); + if (IS_ERR(sp->base)) { + ret = PTR_ERR(sp->base); goto err_put_master; }