diff mbox series

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

Message ID 20220915020245.4001047-1-windhl@126.com (mailing list archive)
State Superseded
Headers show
Series hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API | expand

Commit Message

Liang He Sept. 15, 2022, 2:02 a.m. UTC
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")
Signed-off-by: Liang He <windhl@126.com>
Signed-off-by: Mengda Chen <chenmengda2009@163.com>
---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Guenter Roeck Sept. 15, 2022, 6:59 a.m. UTC | #1
On Thu, Sep 15, 2022 at 10:02:45AM +0800, Liang He wrote:
> 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")
> Signed-off-by: Liang He <windhl@126.com>
> Signed-off-by: Mengda Chen <chenmengda2009@163.com>

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

> ---
>  drivers/hwmon/gsc-hwmon.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
> index d64be48f1ef6..b60ec95b5edb 100644
> --- a/drivers/hwmon/gsc-hwmon.c
> +++ b/drivers/hwmon/gsc-hwmon.c
> @@ -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);
> -- 
> 2.25.1
>
Liang He Sept. 15, 2022, 7:10 a.m. UTC | #2
At 2022-09-15 14:59:10, "Guenter Roeck" <linux@roeck-us.net> wrote:
>On Thu, Sep 15, 2022 at 10:02:45AM +0800, Liang He wrote:
>> 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")
>> Signed-off-by: Liang He <windhl@126.com>
>> Signed-off-by: Mengda Chen <chenmengda2009@163.com>
>
>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



>> ---
>>  drivers/hwmon/gsc-hwmon.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
>> index d64be48f1ef6..b60ec95b5edb 100644
>> --- a/drivers/hwmon/gsc-hwmon.c
>> +++ b/drivers/hwmon/gsc-hwmon.c
>> @@ -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);
>> -- 
>> 2.25.1
>>
Guenter Roeck Sept. 15, 2022, 8:03 a.m. UTC | #3
On Thu, Sep 15, 2022 at 03:10:54PM +0800, Liang He wrote:
> 
> 
> 
> At 2022-09-15 14:59:10, "Guenter Roeck" <linux@roeck-us.net> wrote:
> >On Thu, Sep 15, 2022 at 10:02:45AM +0800, Liang He wrote:
> >> 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")
> >> Signed-off-by: Liang He <windhl@126.com>
> >> Signed-off-by: Mengda Chen <chenmengda2009@163.com>
> >
> >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.
> 

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

> Thanks very much!
> 
> Liang
> 
> 
> 
> >> ---
> >>  drivers/hwmon/gsc-hwmon.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >> 
> >> diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
> >> index d64be48f1ef6..b60ec95b5edb 100644
> >> --- a/drivers/hwmon/gsc-hwmon.c
> >> +++ b/drivers/hwmon/gsc-hwmon.c
> >> @@ -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);
> >> -- 
> >> 2.25.1
> >>
diff mbox series

Patch

diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c
index d64be48f1ef6..b60ec95b5edb 100644
--- a/drivers/hwmon/gsc-hwmon.c
+++ b/drivers/hwmon/gsc-hwmon.c
@@ -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);