Skip to contentSkip to conversation

hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API

PATCH Superseded Liang He 2 participants 4 messages Sep 15, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API

In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument.

Fixes 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")
---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
index d64be48f1ef6..b60ec95b5edb 100644
@@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct device *dev)
 	pdata->nchannels = nchannels;
 
 	/* fan controller base address */
+	of_node_get(dev->parent->of_node);
 	fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan");
 	if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) {
 		of_node_put(fan);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 7 lines · Liang He

In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument.

Fixes 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")

That second Signed-off-by: doesn't make sense in this context since the patch is from and was sent by the first signer.

Guenter

Quoted 19 lines
---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
index d64be48f1ef6..b60ec95b5edb 100644
@@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct device *dev)
 	pdata->nchannels = nchannels;
 
 	/* fan controller base address */
+	of_node_get(dev->parent->of_node);
 	fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan");
 	if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) {
 		of_node_put(fan);
Signature · 1 line
2.25.1
author
#2 lore raw
Quoted 9 lines · Guenter Roeck
Quoted 7 lines · Liang He

In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument.

Fixes 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")
Quoted 5 lines

That second Signed-off-by: doesn't make sense in this context since the patch is from and was sent by the first signer.

Guenter

Hi, Guenter

I wonder if it is OK if mengda send a Signed-off-by for this or I shoud resend another new version (V2) in which I only attach my SOB and then mengda sends his SOB.

Thanks very much!

Liang

Quoted 19 lines
Quoted 19 lines
---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
index d64be48f1ef6..b60ec95b5edb 100644
@@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct device *dev)
 	pdata->nchannels = nchannels;
 
 	/* fan controller base address */
+	of_node_get(dev->parent->of_node);
 	fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan");
 	if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) {
 		of_node_put(fan);
Signature · 1 line
2.25.1
maintainer
#3 lore raw
Quoted 17 lines · Liang He
Quoted 12 lines · Guenter Roeck
Quoted 7 lines · Liang He

In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument.

Fixes 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")

That second Signed-off-by: doesn't make sense in this context since the patch is from and was sent by the first signer.

Quoted 9 lines
Quoted 1 line

Guenter

Hi, Guenter

I wonder if it is OK if mengda send a Signed-off-by for this or I shoud resend another new version (V2) in which I only attach my SOB and then mengda sends his SOB.

That is not how it works. SOB means a patch passed through a person (for example a sub-maintainer). One does not send it as response to a patch. A tag sent as response should be Reviewed-by: or Acked-by:.

Thanks,
Guenter

Quoted 25 lines

Thanks very much!

Liang

Quoted 19 lines
Quoted 19 lines
---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
index d64be48f1ef6..b60ec95b5edb 100644
@@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct device *dev)
 	pdata->nchannels = nchannels;
 
 	/* fan controller base address */
+	of_node_get(dev->parent->of_node);
 	fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan");
 	if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) {
 		of_node_put(fan);
Signature · 1 line
2.25.1