From patchwork Wed May 22 01:15:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10954683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D3891390 for ; Wed, 22 May 2019 01:15:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F270928A64 for ; Wed, 22 May 2019 01:15:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E374E28AB9; Wed, 22 May 2019 01:15:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 8BBD928A64 for ; Wed, 22 May 2019 01:15:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728183AbfEVBPl (ORCPT ); Tue, 21 May 2019 21:15:41 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40303 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728144AbfEVBPl (ORCPT ); Tue, 21 May 2019 21:15:41 -0400 Received: by mail-pf1-f194.google.com with SMTP id u17so371978pfn.7 for ; Tue, 21 May 2019 18:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zgkPEB5XZ9b9X9cOU2xEF1BiqUs2NT/hLhDQBCKndyY=; b=ICfWIVfagetutSTP2wJda5tntZ8oDmNuRYEHtIPXtdZzblw9wcwSioYM0Cl1uKgkyF eJrq8x30tUjUiVJEBeuEd9L85/PFaHhXwWMjpn7vaV1+M+wlxyrehiIS3gi6zDtjpq1L xzg91FyV/tV0HK5AFOt2jNiDTc+/0XPZfAP9f1e24a7tRWBC0fYvNU3NCzvMrvlIQv6L b9nmQy2ntC5zKewyeT1UrrN/oNPxmokx7+8J0II081WOZUXWNLUDrQLiDU2dX6RxQ3h5 UTBsgH9nKnYynRkx4mvTI26Rb00Pt2Guq1VdML4bEstoJaBj06kEcJNeUqHxWP753buF /yxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zgkPEB5XZ9b9X9cOU2xEF1BiqUs2NT/hLhDQBCKndyY=; b=EZCH47QNj9iP7zGep31bEWorYF6GowrxITcSKHW4+b3rPbRGQBHIhaBYrckC2WMMJV iDPTJpsk1HJDfIj4iQYDb8k7C0eK6s8BG0ZVgZsUWm97K5N6CKPu/I9hrK7ZvSU/lm8R FjAW90b9LfRi5e9WxlDrJaSsbZZDZQCiLoaLggOJ31l7B7KeCbSz1oKAUzQQ8XqaoWI9 LlA1r3O6kBvXqpSKBpvj30O6DlFTyx1rT2keTcuK+B3nFGHD1BqeHmCFnwuErflbb+z2 WKnOBvLeCug4QZT9Pi8c6GWYs46Nvh3ugq2X0OSsxWyigjHYoBMaIN2diqTfT+20RGqm vZSw== X-Gm-Message-State: APjAAAXc1CBqxYf/av3hcBLGopRcUQOfv1nB8HMl5lC0aYArfoLcFlbf njVYKD8ZsLT1BBgqf66mBZWDzg== X-Google-Smtp-Source: APXvYqyx8/oA3ktN+AkwStd05O6l9Bb3JYPNrV5Ae9KzmW2T5Zkj8tfBYP+awEYofc0F9+pw0uAlhg== X-Received: by 2002:a63:4c54:: with SMTP id m20mr87048720pgl.316.1558487740876; Tue, 21 May 2019 18:15:40 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id e184sm31756061pfa.169.2019.05.21.18.15.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 18:15:40 -0700 (PDT) From: Chunyan Zhang To: Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Chunyan Zhang , Baolin Wang Subject: [PATCH v2 1/3] clk: sprd: Switch from of_iomap() to devm_ioremap_resource() Date: Wed, 22 May 2019 09:15:01 +0800 Message-Id: <20190522011504.19342-2-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522011504.19342-1-zhang.chunyan@linaro.org> References: <20190522011504.19342-1-zhang.chunyan@linaro.org> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP devm_ioremap_resources() automatically requests resources and devm_ wrappers do better error handling and unmapping of the I/O region when needed, that would make drivers more clean and simple. Signed-off-by: Chunyan Zhang Reviewed-by: Baolin Wang --- drivers/clk/sprd/common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c index e038b0447206..9ce690999eaa 100644 --- a/drivers/clk/sprd/common.c +++ b/drivers/clk/sprd/common.c @@ -42,6 +42,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev, void __iomem *base; struct device_node *node = pdev->dev.of_node; struct regmap *regmap; + struct resource *res; if (of_find_property(node, "sprd,syscon", NULL)) { regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon"); @@ -50,7 +51,11 @@ int sprd_clk_regmap_init(struct platform_device *pdev, return PTR_ERR(regmap); } } else { - base = of_iomap(node, 0); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + regmap = devm_regmap_init_mmio(&pdev->dev, base, &sprdclk_regmap_config); if (IS_ERR_OR_NULL(regmap)) { From patchwork Wed May 22 01:15:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10954685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98F271390 for ; Wed, 22 May 2019 01:15:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F9F28A64 for ; Wed, 22 May 2019 01:15:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E42628AB9; Wed, 22 May 2019 01:15:49 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 292B028A64 for ; Wed, 22 May 2019 01:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728212AbfEVBPs (ORCPT ); Tue, 21 May 2019 21:15:48 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46537 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727930AbfEVBPs (ORCPT ); Tue, 21 May 2019 21:15:48 -0400 Received: by mail-pf1-f196.google.com with SMTP id y11so360310pfm.13 for ; Tue, 21 May 2019 18:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6fbG5fDEzG6AzVFaygO2qy/CXt0Isxn5KLkAJO5SWss=; b=jfN/IPbdiNMb5JRj2CnP/eCgdcf+GAIPN3VeuSPPh8A3Z/LLdTYhT+cSzxiZC5unq3 yZIl3VixybtlbHWsvdnbH922uzO1jUHnvWVjH4WoMf5Nk5C6X0YK8xbiwVkV4I3V2aJR JDqFc4zZoFum0ETZzckdxYA4ywVQmSifOeoHSz9OicminnX2tLgKTK3LSTkClyKWvOJY kAks3r64S0qPczI3NGUDqwbXSehZSaosHHmtgE+rbGmlMcdPfdX8IKr2kL2jGYjFFU+u CHpc7PATBAtA8AMfyylhide8JfBbCzqDn+AnT+Wwgq5PiASu07b5d0gBpPzTiTdOUAOt Pf6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6fbG5fDEzG6AzVFaygO2qy/CXt0Isxn5KLkAJO5SWss=; b=D+WaYpaF4URJnyICRrJ4p2rERMwqTK2jaXIZWCTxcLbnCEsaYRnhF90WaCFwyHgauJ aGmFY7eA41qtJDiCyp1VyDRV23wUXrfKEtd/+5t3Ob1ZbUBurEfeSMPFdL2/3OIevllR f0RieOEhE+KuIVS27oFf3TkK3KrgVE65u/ZH1msTG53Cx78mV4lOMJs+pIsi6P8Xrft7 YccTbJihMaUdEIB2dCdpEx3lATTYqxAZLU8cSd7InROGKqELmw5Y/jtHdyjef/zDVcsG NxiaX9gcohfkrckS6mw1ri/mumzLzukNt06a3hqe0cRx//eSpJvHZXl+xNT6Wbz3SOy4 q99w== X-Gm-Message-State: APjAAAVAAkO22zVXogddaiI+NgVwGaktO92xA2i+RgeYBZM4uApB79rk 9mS61DYrMyOhdT2MXTkqKp0pvw== X-Google-Smtp-Source: APXvYqyfqXtwQYeS2jhPUWE9ejfCsvhPu+c6LXe+/1FDtisubfaiXyyTbN0HcDUqVWq5R5+SRf7ipw== X-Received: by 2002:a63:1f04:: with SMTP id f4mr87297936pgf.423.1558487747679; Tue, 21 May 2019 18:15:47 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id e184sm31756061pfa.169.2019.05.21.18.15.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 18:15:47 -0700 (PDT) From: Chunyan Zhang To: Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Chunyan Zhang , Baolin Wang Subject: [PATCH v2 2/3] clk: sprd: Check error only for devm_regmap_init_mmio() Date: Wed, 22 May 2019 09:15:02 +0800 Message-Id: <20190522011504.19342-3-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522011504.19342-1-zhang.chunyan@linaro.org> References: <20190522011504.19342-1-zhang.chunyan@linaro.org> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The function devm_regmap_init_mmio() wouldn't return NULL pointer for now, so only need to ensure the return value is not an error code. Signed-off-by: Chunyan Zhang Reviewed-by: Baolin Wang --- drivers/clk/sprd/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c index 9ce690999eaa..a5bdca1de5d0 100644 --- a/drivers/clk/sprd/common.c +++ b/drivers/clk/sprd/common.c @@ -58,7 +58,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev, regmap = devm_regmap_init_mmio(&pdev->dev, base, &sprdclk_regmap_config); - if (IS_ERR_OR_NULL(regmap)) { + if (IS_ERR(regmap)) { pr_err("failed to init regmap\n"); return PTR_ERR(regmap); } From patchwork Wed May 22 01:15:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10954687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38F121390 for ; Wed, 22 May 2019 01:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27C3428A64 for ; Wed, 22 May 2019 01:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18D7A28AB9; Wed, 22 May 2019 01:16:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 AEAD028A64 for ; Wed, 22 May 2019 01:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728310AbfEVBPy (ORCPT ); Tue, 21 May 2019 21:15:54 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43614 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728207AbfEVBPx (ORCPT ); Tue, 21 May 2019 21:15:53 -0400 Received: by mail-pf1-f194.google.com with SMTP id c6so365780pfa.10 for ; Tue, 21 May 2019 18:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4R0Z1avkl5DcwArAEdYF5RKsOqx23+ElfNwQfhlhU8U=; b=N+QM6K+mnnUhvHa1pDTd4k5bms70Vaku4Jjp/BA2dHEnOKKOnLtyIKbS/22xAaO5WJ sqV6/CiZpmxKCDFjs1WN4GbfR+dwiBNCrkD/fGw1TgFbrIuB2fFGHlqzCOA16m6sgSts B7bFD7A12JdmPrjFhuEHpW6gIsDlHC52uzpG/x96Rsq4sBLNNDKBmaBNxpPNlPqIDhMH VdhqfkIvdXLUTSgi9+hjW9/+yJDhs303p/1dV1ki442GfeO0gj8pvyBcVXXbA2RqxvXI xOwYpHkDQD6docsy8KCY2NjXUrUPU/j/IdJMNHDkG3gYHfNPCIUo+2XJpvREn7X8+yy2 Xo0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4R0Z1avkl5DcwArAEdYF5RKsOqx23+ElfNwQfhlhU8U=; b=hBIVg0RMNvBG2iaE2iOy2epyy3vjHVRhKFEId2bGbjYa4ovKe+bZk+YpB/EbqDZ1q0 NgUC8W8DhqYjZe/d5lql53k1VxCPQQjrkM4xtYU/52XWiyRvQoDB/Y9fn8MUIfoxh6MN 3YRJSwsqcxEEIsuE8Ov0/jdfCo1xXZj1WDO+JZJYUylWCjzY9jdMQYO0aMsSpMokpJNA T/T7aqs/D+t6seWjth0U6OR9VG4hflrOCK2mMI50esFfozBiRnK7J6z9fEE6ijjNcnjJ ErlycNa7omdY0KnWUf01si8QWSWwotqeqPS8iHxYOF7pzknfvOj2THThmEZW+vJuDJHb 3JDQ== X-Gm-Message-State: APjAAAViJWoKZ51kJzCk1SfqHzQU1jlrUAooPUXEkTb8i3yZRVUuhtxO 2RrweXyWHzmChv+uhfaz0hQPLw== X-Google-Smtp-Source: APXvYqzbklwZKF6I8bdsKqHWeztOzDBBspaVQu25VOCc+BGlsekcn7V3hdflg1i8vRhnSKdoGmRD3Q== X-Received: by 2002:a62:640e:: with SMTP id y14mr72010463pfb.109.1558487753226; Tue, 21 May 2019 18:15:53 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id e184sm31756061pfa.169.2019.05.21.18.15.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 18:15:52 -0700 (PDT) From: Chunyan Zhang To: Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Chunyan Zhang , Baolin Wang Subject: [PATCH v2 3/3] clk: sprd: Add check the return value of sprd_clk_regmap_init() Date: Wed, 22 May 2019 09:15:04 +0800 Message-Id: <20190522011504.19342-5-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522011504.19342-1-zhang.chunyan@linaro.org> References: <20190522011504.19342-1-zhang.chunyan@linaro.org> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sprd_clk_regmap_init() doesn't always return success, adding check for its return value should make the code more strong. Signed-off-by: Chunyan Zhang --- drivers/clk/sprd/sc9860-clk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clk/sprd/sc9860-clk.c b/drivers/clk/sprd/sc9860-clk.c index 9980ab55271b..1ed45b4f2fe8 100644 --- a/drivers/clk/sprd/sc9860-clk.c +++ b/drivers/clk/sprd/sc9860-clk.c @@ -2031,7 +2031,9 @@ static int sc9860_clk_probe(struct platform_device *pdev) } desc = match->data; - sprd_clk_regmap_init(pdev, desc); + ret = sprd_clk_regmap_init(pdev, desc); + if (ret) + return ret; return sprd_clk_probe(&pdev->dev, desc->hw_clks); }