hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API
Subsystems (2)
PATCH v3 1/1 hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API
From: Liang He <[email protected]>
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 <[email protected]>
Co-developed-by Mengda Chen <[email protected]>
Signed-off-by Mengda Chen <[email protected]>
--- drivers/hwmon/gsc-hwmon.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
@@ -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
Quoted 10 lines · Mengda Chen
From: Liang He <[email protected]>
In
gsc_hwmon_get_devtree_pdata(), we should callof_node_get()before theof_find_compatible_node()which will automatically callof_node_put()for the 'from' argument.Fixes 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")Signed-off-by Liang He <[email protected]>Co-developed-by Mengda Chen <[email protected]>Signed-off-by Mengda Chen <[email protected]>
Applied.
Thanks,
Guenter