All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API
@ 2022-09-16 15:47 Mengda Chen
  2022-09-19 13:16 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Mengda Chen @ 2022-09-16 15:47 UTC (permalink / raw)
  To: tharvey, jdelvare, linux, linux-hwmon; +Cc: windhl, chenmengda2009

From: Liang He <windhl@126.com>

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>
Co-developed-by: Mengda Chen <chenmengda2009@163.com>
Signed-off-by: Mengda Chen <chenmengda2009@163.com>
---
 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


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

* Re: [PATCH v3] hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API
  2022-09-16 15:47 [PATCH v3] hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API Mengda Chen
@ 2022-09-19 13:16 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-09-19 13:16 UTC (permalink / raw)
  To: Mengda Chen; +Cc: tharvey, jdelvare, linux-hwmon, windhl

On Fri, Sep 16, 2022 at 11:47:08PM +0800, Mengda Chen wrote:
> From: Liang He <windhl@126.com>
> 
> 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>
> Co-developed-by: Mengda Chen <chenmengda2009@163.com>
> Signed-off-by: Mengda Chen <chenmengda2009@163.com>

Applied.

Thanks,
Guenter

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

end of thread, other threads:[~2022-09-19 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 15:47 [PATCH v3] hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API Mengda Chen
2022-09-19 13:16 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.