linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle()
@ 2019-10-08  7:41 Baolin Wang
  2019-10-08  7:41 ` [PATCH v2 2/2] clk: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Baolin Wang @ 2019-10-08  7:41 UTC (permalink / raw)
  To: mturquette, sboyd
  Cc: orsonzhai, baolin.wang, zhang.lyra, linux-clk, linux-kernel

The syscon_regmap_lookup_by_phandle() will never return NULL, thus use
IS_ERR() to validate the return value instead of IS_ERR_OR_NULL().

Fixes: d41f59fd92f2 ("clk: sprd: Add common infrastructure")
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
Changes from v1:
 - Add fixes tag.
---
 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 9d56eac..7ad5ba2 100644
--- a/drivers/clk/sprd/common.c
+++ b/drivers/clk/sprd/common.c
@@ -46,7 +46,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 
 	if (of_find_property(node, "sprd,syscon", NULL)) {
 		regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon");
-		if (IS_ERR_OR_NULL(regmap)) {
+		if (IS_ERR(regmap)) {
 			pr_err("%s: failed to get syscon regmap\n", __func__);
 			return PTR_ERR(regmap);
 		}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] clk: sprd: Change to use devm_platform_ioremap_resource()
  2019-10-08  7:41 [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle() Baolin Wang
@ 2019-10-08  7:41 ` Baolin Wang
  2019-10-16 23:18   ` Stephen Boyd
  2019-11-05  8:24 ` [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle() Baolin Wang
  2019-11-13 23:00 ` Stephen Boyd
  2 siblings, 1 reply; 5+ messages in thread
From: Baolin Wang @ 2019-10-08  7:41 UTC (permalink / raw)
  To: mturquette, sboyd
  Cc: orsonzhai, baolin.wang, zhang.lyra, linux-clk, linux-kernel

Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together, which can simpify the code.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
Changes from v1:
 - None.
---
 drivers/clk/sprd/common.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c
index 7ad5ba2..c0af477 100644
--- a/drivers/clk/sprd/common.c
+++ b/drivers/clk/sprd/common.c
@@ -42,7 +42,6 @@ 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");
@@ -51,8 +50,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 			return PTR_ERR(regmap);
 		}
 	} else {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		base = devm_ioremap_resource(&pdev->dev, res);
+		base = devm_platform_ioremap_resource(pdev, 0);
 		if (IS_ERR(base))
 			return PTR_ERR(base);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] clk: sprd: Change to use devm_platform_ioremap_resource()
  2019-10-08  7:41 ` [PATCH v2 2/2] clk: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
@ 2019-10-16 23:18   ` Stephen Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2019-10-16 23:18 UTC (permalink / raw)
  To: Baolin Wang, mturquette
  Cc: orsonzhai, baolin.wang, zhang.lyra, linux-clk, linux-kernel

Quoting Baolin Wang (2019-10-08 00:41:39)
> Use the new helper that wraps the calls to platform_get_resource()
> and devm_ioremap_resource() together, which can simpify the code.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---

Applied to clk-next


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle()
  2019-10-08  7:41 [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle() Baolin Wang
  2019-10-08  7:41 ` [PATCH v2 2/2] clk: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
@ 2019-11-05  8:24 ` Baolin Wang
  2019-11-13 23:00 ` Stephen Boyd
  2 siblings, 0 replies; 5+ messages in thread
From: Baolin Wang @ 2019-11-05  8:24 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Orson Zhai, Chunyan Zhang, linux-clk, LKML

Hi Stephen,

On Tue, 8 Oct 2019 at 15:41, Baolin Wang <baolin.wang@linaro.org> wrote:
>
> The syscon_regmap_lookup_by_phandle() will never return NULL, thus use
> IS_ERR() to validate the return value instead of IS_ERR_OR_NULL().
>
> Fixes: d41f59fd92f2 ("clk: sprd: Add common infrastructure")
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
> Changes from v1:
>  - Add fixes tag.
> ---

I did not see this patch in your clk tree (you only applied patch 2 in
this patch set), could you apply this patch if no other issues?
Thanks.

>  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 9d56eac..7ad5ba2 100644
> --- a/drivers/clk/sprd/common.c
> +++ b/drivers/clk/sprd/common.c
> @@ -46,7 +46,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
>
>         if (of_find_property(node, "sprd,syscon", NULL)) {
>                 regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon");
> -               if (IS_ERR_OR_NULL(regmap)) {
> +               if (IS_ERR(regmap)) {
>                         pr_err("%s: failed to get syscon regmap\n", __func__);
>                         return PTR_ERR(regmap);
>                 }
> --
> 1.7.9.5
>


-- 
Baolin Wang
Best Regards

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle()
  2019-10-08  7:41 [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle() Baolin Wang
  2019-10-08  7:41 ` [PATCH v2 2/2] clk: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
  2019-11-05  8:24 ` [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle() Baolin Wang
@ 2019-11-13 23:00 ` Stephen Boyd
  2 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2019-11-13 23:00 UTC (permalink / raw)
  To: Baolin Wang, mturquette
  Cc: orsonzhai, baolin.wang, zhang.lyra, linux-clk, linux-kernel

Quoting Baolin Wang (2019-10-08 00:41:38)
> The syscon_regmap_lookup_by_phandle() will never return NULL, thus use
> IS_ERR() to validate the return value instead of IS_ERR_OR_NULL().
> 
> Fixes: d41f59fd92f2 ("clk: sprd: Add common infrastructure")
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---

Applied to clk-next


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-13 23:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08  7:41 [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle() Baolin Wang
2019-10-08  7:41 ` [PATCH v2 2/2] clk: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
2019-10-16 23:18   ` Stephen Boyd
2019-11-05  8:24 ` [PATCH v2 1/2] clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle() Baolin Wang
2019-11-13 23:00 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).