From patchwork Mon May 23 09:30:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 68347 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1119912qge; Mon, 23 May 2016 02:30:40 -0700 (PDT) X-Received: by 10.98.96.130 with SMTP id u124mr25056577pfb.28.1463995830857; Mon, 23 May 2016 02:30:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si50560446par.183.2016.05.23.02.30.30; Mon, 23 May 2016 02:30:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753718AbcEWJaX (ORCPT + 4 others); Mon, 23 May 2016 05:30:23 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:33883 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753689AbcEWJaV (ORCPT ); Mon, 23 May 2016 05:30:21 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O7M00FBAIEGH540@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Mon, 23 May 2016 10:30:16 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-b2-5742cda89189 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 1B.69.04866.8ADC2475; Mon, 23 May 2016 10:30:16 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O7M00M2SIECIH30@eusync4.samsung.com>; Mon, 23 May 2016 10:30:16 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , Joerg Roedel , Inki Dae , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 1/3] iommu/exynos: Return proper errors from getting clocks Date: Mon, 23 May 2016 11:30:07 +0200 Message-id: <1463995809-26862-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1463995809-26862-1-git-send-email-m.szyprowski@samsung.com> References: <1463995809-26862-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrILMWRmVeSWpSXmKPExsVy+t/xa7orzjqFG7SvFLDYOGM9q8Wk+xNY LBbst7bonL2B3eL1C0OL/sevmS02Pb7GajHj/D4mi7VH7rI7cHo8OTiPyWPTqk42j81L6j0m 31jO6NG3ZRWjx+dNcgFsUVw2Kak5mWWpRfp2CVwZ23Y1MRb0iVRcbNzI3MA4RaCLkZNDQsBE 4ur0GWwQtpjEhXvrgWwuDiGBpYwSB6+1QDlNTBLv//0Hq2ITMJToetsFZosI5Eu82PuXBaSI WeAXo8S5znYmkISwgLfE//PvmEFsFgFViYenpoA18Ap4SDQ9/MgMsU5O4v/LFWD1nAKeEg+X 3QWrEQKqmX9hCtMERt4FjAyrGEVTS5MLipPSc430ihNzi0vz0vWS83M3MUIC7usOxqXHrA4x CnAwKvHwcrA4hQuxJpYVV+YeYpTgYFYS4c08DRTiTUmsrEotyo8vKs1JLT7EKM3BoiTOO3PX +xAhgfTEktTs1NSC1CKYLBMHp1QDI7ui1680n7DvtnX5nv8nZ893YI2cGbg0sS/jfxR38+ol 3CdmXz1yLeN3uI51wsvCsG6RkFURnnd3r5qwe1rR+8TproenPZwvLxPlVuT2yXTWojcCF3bv n63nuZFzxvfLx8pFEzivKHExRvcFmMo2d5zRSg//zS/8rfymz8mjMZw/961iqzy5U4mlOCPR UIu5qDgRAMgKuRg0AgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch reworks driver probe code to propagate error codes from clk_get() operation. This will allow to properly handle deferred probe in the future. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 56 +++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 32 deletions(-) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index e27e3b7df4e7..989365682d14 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -602,37 +602,31 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) } data->clk = devm_clk_get(dev, "sysmmu"); - if (!IS_ERR(data->clk)) { - ret = clk_prepare(data->clk); - if (ret) { - dev_err(dev, "Failed to prepare clk\n"); - return ret; - } - } else { + if (PTR_ERR(data->clk) == -ENOENT) data->clk = NULL; - } + else if (IS_ERR(data->clk)) + return PTR_ERR(data->clk); + ret = clk_prepare(data->clk); + if (ret) + return ret; data->aclk = devm_clk_get(dev, "aclk"); - if (!IS_ERR(data->aclk)) { - ret = clk_prepare(data->aclk); - if (ret) { - dev_err(dev, "Failed to prepare aclk\n"); - return ret; - } - } else { + if (PTR_ERR(data->aclk) == -ENOENT) data->aclk = NULL; - } + else if (IS_ERR(data->aclk)) + return PTR_ERR(data->aclk); + ret = clk_prepare(data->aclk); + if (ret) + return ret; data->pclk = devm_clk_get(dev, "pclk"); - if (!IS_ERR(data->pclk)) { - ret = clk_prepare(data->pclk); - if (ret) { - dev_err(dev, "Failed to prepare pclk\n"); - return ret; - } - } else { + if (PTR_ERR(data->pclk) == -ENOENT) data->pclk = NULL; - } + else if (IS_ERR(data->pclk)) + return PTR_ERR(data->pclk); + ret = clk_prepare(data->pclk); + if (ret) + return ret; if (!data->clk && (!data->aclk || !data->pclk)) { dev_err(dev, "Failed to get device clock(s)!\n"); @@ -640,15 +634,13 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) } data->clk_master = devm_clk_get(dev, "master"); - if (!IS_ERR(data->clk_master)) { - ret = clk_prepare(data->clk_master); - if (ret) { - dev_err(dev, "Failed to prepare master's clk\n"); - return ret; - } - } else { + if (PTR_ERR(data->clk_master) == -ENOENT) data->clk_master = NULL; - } + else if (IS_ERR(data->clk_master)) + return PTR_ERR(data->clk_master); + ret = clk_prepare(data->clk_master); + if (ret) + return ret; data->sysmmu = dev; spin_lock_init(&data->lock);