From patchwork Thu Feb 23 10:12:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9588009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 969F5601AE for ; Thu, 23 Feb 2017 10:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87CEB286EC for ; Thu, 23 Feb 2017 10:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A4B6286F7; Thu, 23 Feb 2017 10:12:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AB0A286EC for ; Thu, 23 Feb 2017 10:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751239AbdBWKMt (ORCPT ); Thu, 23 Feb 2017 05:12:49 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:30264 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbdBWKMs (ORCPT ); Thu, 23 Feb 2017 05:12:48 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLT00M8VOD9Y380@mailout4.w1.samsung.com>; Thu, 23 Feb 2017 10:12:45 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170223101244eucas1p1e0852526c3d4d3b7739b2db11cbc2dbd~l4u5Gh0JI1249712497eucas1p1x; Thu, 23 Feb 2017 10:12:44 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 38.53.30614.C95BEA85; Thu, 23 Feb 2017 10:12:44 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170223101244eucas1p2eddf13a013d66f9ccdbe45f410b5939c~l4u4XnxJU2767227672eucas1p21; Thu, 23 Feb 2017 10:12:44 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-bb-58aeb59c28f0 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 83.86.10233.2A5BEA85; Thu, 23 Feb 2017 10:12:50 +0000 (GMT) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLT007ZWOD7NL40@eusync3.samsung.com>; Thu, 23 Feb 2017 10:12:43 +0000 (GMT) From: Andrzej Hajda To: Tomasz Figa , Krzysztof Kozlowski , Sylwester Nawrocki , Linus Walleij , linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [PATCH v2] pinctrl: samsung: Fix memory mapping code Date: Thu, 23 Feb 2017 11:12:40 +0100 Message-id: <1487844760-26272-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <20170222170202.heu35anyoziwv23n@kozik-lap> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKIsWRmVeSWpSXmKPExsWy7djPc7pztq6LMLgxQcPi1rpzrBYbZ6xn tTh/fgO7xZQ/y5ksNs//w2gx4/w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3OAe7CSvl2CW8buc88YC65yVyz5tJa5gfEJZxcjJ4eEgInE7fNfWSBsMYkL 99azdTFycQgJLGGUWNV6jQkkISTQyCTx8rUkiM0moCnxd/NNsCIRgVeMEh29c5lAHGaBPkaJ xr+r2ECqhAVsJbbevMbaxcjBwSKgKrGr0xAkzCvgLHF9wj12iG1yEjfPdTKD2JwCFhIf/zey QSwzl7jy4DjjBEbeBYwMqxhFUkuLc9Nzi430ihNzi0vz0vWS83M3MQIDfNuxn1t2MHa9Cz7E KMDBqMTDe2DR2ggh1sSy4srcQ4wSHMxKIryca9dFCPGmJFZWpRblxxeV5qQWH2I0BbppIrOU aHI+MPrySuINTQzNLQ2NjC0szI2MlMR5p364Ei4kkJ5YkpqdmlqQWgTTx8TBKdXAOOPGqwMa 0YIdK288njL1dXcjWwDf9BX8jfY3LgT9tTV6snWzjqjexZXXZ2YEvkya9snxzh3OA+ulciJa 9+rwiKcnTbjO+dkr/Up3c/uVsstNLakMsmxBPyKu9W1SZTxw9vIj0ah3glEtxSd3tT0+OOVV gP7MbwvSFrGKKN+K466rtFSNZTgrp8RSnJFoqMVcVJwIAN5wUTaGAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170223101244eucas1p2eddf13a013d66f9ccdbe45f410b5939c X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170223101244eucas1p2eddf13a013d66f9ccdbe45f410b5939c X-RootMTR: 20170223101244eucas1p2eddf13a013d66f9ccdbe45f410b5939c References: <20170222170202.heu35anyoziwv23n@kozik-lap> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some pinctrls share memory regions, and devm_ioremap_resource does not allow to share resources, in opposition to devm_ioremap. This patch restores back usage of devm_ioremap function, but with proper error handling and logging. Fixes: baafaca ("pinctrl: samsung: Fix return value check in samsung_pinctrl_get_soc_data()") Signed-off-by: Andrzej Hajda Reviewed-by: Krzysztof Kozlowski --- v2: - added platform_get_resource error check (thanks to Krzysztof) drivers/pinctrl/samsung/pinctrl-samsung.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index f9ddba7..d7aa22c 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -988,9 +988,16 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, for (i = 0; i < ctrl->nr_ext_resources + 1; i++) { res = platform_get_resource(pdev, IORESOURCE_MEM, i); - virt_base[i] = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(virt_base[i])) - return ERR_CAST(virt_base[i]); + if (!res) { + dev_err(&pdev->dev, "failed to get mem%d resource\n", i); + return ERR_PTR(-EINVAL); + } + virt_base[i] = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (!virt_base[i]) { + dev_err(&pdev->dev, "failed to ioremap %pR\n", res); + return ERR_PTR(-EIO); + } } bank = d->pin_banks;