Message ID | 20240823071555.3331632-1-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | [-next] thermal/of: Fix duplicate of_node_put() | expand |
On Fri, Aug 23, 2024 at 9:08 AM Jinjie Ruan <ruanjinjie@huawei.com> wrote: > > In for_each_child_of_node(), if continue, of_node_put(prev) will be > called by __of_get_next_child(), so remove the duplicate > of_node_put(child). > > Fixes: 0f0a1b4ba3e4 ("thermal/of: Use the .should_bind() thermal zone callback") > Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> > --- > drivers/thermal/thermal_of.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c > index dc43f50db890..85e7e3c43c7e 100644 > --- a/drivers/thermal/thermal_of.c > +++ b/drivers/thermal/thermal_of.c > @@ -319,10 +319,8 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, > int count, i; > > tr_np = of_parse_phandle(child, "trip", 0); > - if (tr_np != trip->priv) { > - of_node_put(child); > + if (tr_np != trip->priv) > continue; > - } > > /* The trip has been found, look up the cdev. */ > count = of_count_phandle_with_args(child, "cooling-device", "#cooling-cells"); > -- Good catch, thank you! I'll fix the original patch and reapply it.
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index dc43f50db890..85e7e3c43c7e 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -319,10 +319,8 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz, int count, i; tr_np = of_parse_phandle(child, "trip", 0); - if (tr_np != trip->priv) { - of_node_put(child); + if (tr_np != trip->priv) continue; - } /* The trip has been found, look up the cdev. */ count = of_count_phandle_with_args(child, "cooling-device", "#cooling-cells");
In for_each_child_of_node(), if continue, of_node_put(prev) will be called by __of_get_next_child(), so remove the duplicate of_node_put(child). Fixes: 0f0a1b4ba3e4 ("thermal/of: Use the .should_bind() thermal zone callback") Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- drivers/thermal/thermal_of.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)