Skip to contentSkip to conversation

clk: sprd: Hold reference returned by of_get_parent()

PATCH Superseded Liang He 3 participants 9 messages Jul 1, 2022 – Jul 2, 2022

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH v4 1/1 clk: sprd: Hold reference returned by of_get_parent()

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +5 -4
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
 	void __iomem *base;
 	struct device *dev = &pdev->dev;
-	struct device_node *node = dev->of_node;
+	struct device_node *node = dev->of_node, *np;
 	struct regmap *regmap;
 
 	if (of_find_property(node, "sprd,syscon", NULL)) {
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 			pr_err("%s: failed to get syscon regmap\n", __func__);
 			return PTR_ERR(regmap);
 		}
-	} else if (of_device_is_compatible(of_get_parent(dev->of_node),
-			   "syscon")) {
-		regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+	} else if (of_device_is_compatible(np =	of_get_parent(node), "syscon")
+		|| (of_node_put(np), 0)) {
+		regmap = device_node_to_regmap(np = of_get_parent(node));
+		of_node_put(np);
 		if (IS_ERR(regmap)) {
 			dev_err(dev, "failed to get regmap from its parent.\n");
 			return PTR_ERR(regmap);
Signature · 1 line
2.25.1
maintainer
#1 lore raw

Hi Liang,

Quoted 6 lines · Liang He

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

You are using the wrong patch number here.
Please re-send this patch with subject that begins with [PATCH V4] ... and add Reviewed-by: Orson Zhai <[email protected]>

Thanks.

-Orson

Quoted 43 lines

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +5 -5
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1

maintainer Reviewed-by
#2 lore raw
Quoted 5 lines · Orson Zhai

Hi Liang,

Quoted 1 line · Liang He
Quoted 8 lines
Quoted 5 lines

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

You are using the wrong patch number here.
Please re-send this patch with subject that begins with [PATCH V4] ...

Sorry, the patch number is correct but it's collapsed with patch v2 in my mailbox.
Maybe you are using the same message id for all these patches? Anyway, the code change looks good to me.

Thanks.
-Orson

Quoted 49 lines

and add Reviewed-by: Orson Zhai <[email protected]>

Thanks.

-Orson

Quoted 43 lines

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +5 -5
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1

reviewer
#3 lore raw
In reply to Liang He
Quoted 33 lines · Liang He

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +1 -1
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {

drivers/clk/sprd/common.c int sprd_clk_regmap_init(struct platform_device *pdev, · line 55

Quoted 9 lines
drivers/clk/sprd/common.c +3 -3
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));

of_get_parent() one more time would cause another unbalance, why not use 'np' directly here?

I would also suggest to cc LKML ([email protected])

Thanks,
Chunyan

Quoted 7 lines
drivers/clk/sprd/common.c +1 -1
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1

author
#4 lore raw
Quoted 47 lines · Chunyan Zhang
Quoted 33 lines · Liang He

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +1 -1
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {

drivers/clk/sprd/common.c int sprd_clk_regmap_init(struct platform_device *pdev, · line 55

Quoted 9 lines
drivers/clk/sprd/common.c +3 -3
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));

of_get_parent() one more time would cause another unbalance, why not use 'np' directly here?

Quoted 5 lines

I would also suggest to cc LKML ([email protected])

Thanks,
Chunyan

Hi, Chunyan,

Thanks for reviewing this patch code.

In fact, the 'np' has already been |PUT| in the 'else if ( ...|| of_node_put(np)..)'.

Based on the original code, there are two of_get_parent(), so we need the second one with the following second |PUT|.

Thanks,

Liang

Quoted 7 lines
Quoted 7 lines
drivers/clk/sprd/common.c +1 -1
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1

maintainer
#5 lore raw

Liang,

Quoted 57 lines · Liang He
Quoted 47 lines · Chunyan Zhang
Quoted 33 lines · Liang He

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +1 -1
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {

drivers/clk/sprd/common.c int sprd_clk_regmap_init(struct platform_device *pdev, · line 55

Quoted 9 lines
drivers/clk/sprd/common.c +3 -3
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));

of_get_parent() one more time would cause another unbalance, why not use 'np' directly here?

Quoted 5 lines

I would also suggest to cc LKML ([email protected])

Thanks,
Chunyan

Quoted 8 lines

Hi, Chunyan,

Thanks for reviewing this patch code.

In fact, the 'np' has already been |PUT| in the 'else if ( ...|| of_node_put(np)..)'.

Based on the original code, there are two of_get_parent(), so we need the second one with the following second |PUT|.

Sorry, I missed it. I think what Chunyan said is right.

np is declared at the beginning, so it's ok to be referred to in all places in this function
after being assigned.
the first of_node_put() will not be called if of_device_is_compatible() returns success.
So we can refer to np directly here.

-Orson

Quoted 12 lines

Thanks,

Liang

Quoted 7 lines
Quoted 7 lines
drivers/clk/sprd/common.c +1 -1
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1

author
#6 lore raw
Quoted 71 lines · Orson Zhai

Liang,

Quoted 57 lines · Liang He
Quoted 47 lines · Chunyan Zhang
Quoted 33 lines · Liang He

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +1 -1
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {

drivers/clk/sprd/common.c int sprd_clk_regmap_init(struct platform_device *pdev, · line 55

Quoted 9 lines
drivers/clk/sprd/common.c +3 -3
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));

of_get_parent() one more time would cause another unbalance, why not use 'np' directly here?

Quoted 5 lines

I would also suggest to cc LKML ([email protected])

Thanks,
Chunyan

Quoted 8 lines

Hi, Chunyan,

Thanks for reviewing this patch code.

In fact, the 'np' has already been |PUT| in the 'else if ( ...|| of_node_put(np)..)'.

Based on the original code, there are two of_get_parent(), so we need the second one with the following second |PUT|.

Sorry, I missed it. I think what Chunyan said is right.

Quoted 9 lines

np is declared at the beginning, so it's ok to be referred to in all places in this function
after being assigned.
the first of_node_put() will not be called if of_device_is_compatible() returns success.
So we can refer to np directly here.

-Orson

Thanks, Orson and Chunyan.

I have learned a great lesson.

This is what I learned:

if of_device_is_compatible() returns success, the first of_node_put as the '||' will not be called, then we directly use 'np' in the branch and also use it to call the second of_node_put().

If of_device_is_compatible() returns false, the branch will not be executed, but the of_node_put() in the 'else if' condition will be executued.

If this is the truth, I will begin to prepare my new version patch.

Thanks again for both of you.

Liang

Quoted 12 lines
Quoted 12 lines

Thanks,

Liang

Quoted 7 lines
Quoted 7 lines
drivers/clk/sprd/common.c +1 -1
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1

author
#7 lore raw
In reply to Orson Zhai
Quoted 69 lines · Orson Zhai

Liang,

Quoted 57 lines · Liang He
Quoted 47 lines · Chunyan Zhang
Quoted 33 lines · Liang He

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +1 -1
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {

drivers/clk/sprd/common.c int sprd_clk_regmap_init(struct platform_device *pdev, · line 55

Quoted 9 lines
drivers/clk/sprd/common.c +3 -3
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));

of_get_parent() one more time would cause another unbalance, why not use 'np' directly here?

Quoted 5 lines

I would also suggest to cc LKML ([email protected])

Thanks,
Chunyan

Quoted 8 lines

Hi, Chunyan,

Thanks for reviewing this patch code.

In fact, the 'np' has already been |PUT| in the 'else if ( ...|| of_node_put(np)..)'.

Based on the original code, there are two of_get_parent(), so we need the second one with the following second |PUT|.

Quoted 7 lines

Sorry, I missed it. I think what Chunyan said is right.

np is declared at the beginning, so it's ok to be referred to in all places in this function
after being assigned.
the first of_node_put() will not be called if of_device_is_compatible() returns success.

Hi, Orson,

Now, I think this totally depends on the implementation of compilers.

So, we should introduce this possible risk or use more conservative way I use before?

do not put |PUT| in condition and move it to the 'else' branch?

Thanks,

Liang

Quoted 16 lines

So we can refer to np directly here.

-Orson

Quoted 12 lines

Thanks,

Liang

Quoted 7 lines
Quoted 7 lines
drivers/clk/sprd/common.c +1 -1
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1

maintainer
#8 lore raw

Liang,

Quoted 83 lines · Liang He
Quoted 69 lines · Orson Zhai

Liang,

Quoted 57 lines · Liang He
Quoted 47 lines · Chunyan Zhang
Quoted 33 lines · Liang He

We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.

Fixes f95e8c7923d1 ("clk: sprd: support to get regmap from parent node")

---
changelog:

v4: fix another bug in the same place, missing in v3
v3: (1) keep original 'if-else if-else' coding style adviesd by Orson

     (2) fix typo in commit-log: of_node_out --> of_node_put

v2: minimize the effective range of of_get_parent() advised by Orson
v1: hold reference returned by of_get_parent()

 drivers/clk/sprd/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/sprd/common.c +1 -1
index d620bbbcdfc8..1b9c2aa0836f 100644
@@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
 {
        void __iomem *base;
        struct device *dev = &pdev->dev;
-       struct device_node *node = dev->of_node;
+       struct device_node *node = dev->of_node, *np;
        struct regmap *regmap;
 
        if (of_find_property(node, "sprd,syscon", NULL)) {

drivers/clk/sprd/common.c int sprd_clk_regmap_init(struct platform_device *pdev, · line 55

Quoted 9 lines
drivers/clk/sprd/common.c +3 -3
@@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
                        pr_err("%s: failed to get syscon regmap\n", __func__);
                        return PTR_ERR(regmap);
                }
-       } else if (of_device_is_compatible(of_get_parent(dev->of_node),
-                          "syscon")) {
-               regmap = device_node_to_regmap(of_get_parent(dev->of_node));
+       } else if (of_device_is_compatible(np = of_get_parent(node), "syscon")
+               || (of_node_put(np), 0)) {
+               regmap = device_node_to_regmap(np = of_get_parent(node));

of_get_parent() one more time would cause another unbalance, why not use 'np' directly here?

Quoted 5 lines

I would also suggest to cc LKML ([email protected])

Thanks,
Chunyan

Quoted 8 lines

Hi, Chunyan,

Thanks for reviewing this patch code.

In fact, the 'np' has already been |PUT| in the 'else if ( ...|| of_node_put(np)..)'.

Based on the original code, there are two of_get_parent(), so we need the second one with the following second |PUT|.

Quoted 7 lines

Sorry, I missed it. I think what Chunyan said is right.

np is declared at the beginning, so it's ok to be referred to in all places in this function
after being assigned.
the first of_node_put() will not be called if of_device_is_compatible() returns success.

Quoted 4 lines

Hi, Orson,

Now, I think this totally depends on the implementation of compilers.

Don't worry. Logical OR (||) is guaranteed in C standard. Check [1] for more information, please.

-Orson

[1] https://www.geeksforgeeks.org/sequence-points-in-c-set-1/

Quoted 25 lines

So, we should introduce this possible risk or use more conservative way I use before?

do not put |PUT| in condition and move it to the 'else' branch?

Thanks,

Liang

Quoted 16 lines

So we can refer to np directly here.

-Orson

Quoted 12 lines

Thanks,

Liang

Quoted 7 lines
Quoted 7 lines
drivers/clk/sprd/common.c +1 -1
+               of_node_put(np);
                if (IS_ERR(regmap)) {
                        dev_err(dev, "failed to get regmap from its parent.\n");
                        return PTR_ERR(regmap);
--

2.25.1