[PATCH 5/9] powerpc: Use of_find_node_by_name_balanced() to find device_node

2025-02-06 Thread Zhang Zekun
Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- arch/powerpc/platforms/powermac/pic.c | 4 +--- 1 file

[PATCH 9/9] regulator: scmi: Use of_find_node_by_name_balanced() to find device_node

2025-02-06 Thread Zhang Zekun
Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- drivers/regulator/scmi-regulator.c | 3 +-- 1 file changed, 1

[PATCH 8/9] net: prestera: Use of_find_node_by_name_balanced() to find device_node

2025-02-06 Thread Zhang Zekun
Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- drivers/net/ethernet/marvell/prestera/prestera_main.c | 3

[PATCH 7/9] net: dsa: hellcreek: Use of_find_node_by_name_balanced() to find device_node

2025-02-06 Thread Zhang Zekun
Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- drivers/net/dsa/hirschmann/hellcreek_ptp.c | 3 +-- 1 file

[PATCH 3/9] net: pse-pd: Add missing of_node_get() before of_find_node_by_name()

2025-02-06 Thread Zhang Zekun
of_find_node_by_name() will decrease the refount of the device_node. So, get the device_node before passing to it. Fixes: 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver") Signed-off-by: Zhang Zekun --- drivers/net/pse-pd/tps23881.c | 2 +- 1 file changed, 1 inser

[PATCH 4/9] media: max9286: Use of_find_node_by_name_balanced() to find device_node

2025-02-06 Thread Zhang Zekun
Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- drivers/media/i2c/max9286.c | 4 +--- 1 file changed, 1

[PATCH 6/9] net: dsa: Use of_find_node_by_name_balanced() to find device_node

2025-02-06 Thread Zhang Zekun
Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- drivers/net/dsa/bcm_sf2.c | 4 +--- 1 file changed, 1

[PATCH 0/9] Add wrapper function of_find_node_by_name_balanced()

2025-02-06 Thread Zhang Zekun
Add wrapper function of_find_node_by_name_balanced() for drivers who want to call of_find_node_by_name() and have to blance the ref count by calling of_node_get(). For drivers who forget to call of_node_get(), can also utilizing of_find_node_by_name_balanced() to fix a refcount leak. Zhang Zekun

[PATCH 2/9] net: bcmasp: Add missing of_node_get() before of_find_node_by_name()

2025-02-06 Thread Zhang Zekun
of_find_node_by_name() will decrease the refcount of the device_node. So, get the device_node before passing to it. Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller") Signed-off-by: Zhang Zekun --- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 2 +- 1 fi

[PATCH 1/9] of: Add warpper function of_find_node_by_name_balanced()

2025-02-06 Thread Zhang Zekun
of_find_node_by_name(), drivers may use this function to call of_find_node_by_name() with the refcount already balanced. [1] https://lore.kernel.org/all/20241024015909.58654-1-zhangzeku...@huawei.com/ Signed-off-by: Zhang Zekun --- include/linux/of.h | 5 + 1 file changed, 5 insertions

[PATCH] soc: fsl: Add missing of_node_put() after using device_node

2024-11-05 Thread Zhang Zekun
of_find_compatible_node() will increase the refcount of the device_node. Decrease the refcount once finish using it. Fixes: e95f287deed2 ("soc: fsl: handle RCPM errata A-008646 on SoC LS1021A") Signed-off-by: Zhang Zekun --- drivers/soc/fsl/rcpm.c | 1 + 1 file changed, 1 insertio

[PATCH] powerpc/chrp: Add missing of_node_get() before of_find_node_by_name()

2024-10-23 Thread Zhang Zekun
of_find_node_by_name() will decrease the refount of the device_node. So, get the device_node before passing to it. Signed-off-by: Zhang Zekun --- arch/powerpc/platforms/chrp/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms

[PATCH] powerpc/kexec: Fix the return of uninitialized variable

2024-09-30 Thread Zhang Zekun
The of_property_read_u64() can fail and remain the variable uninitialized, which will then be used. Return error if we failed to read the property. Fixes: 2e6bd221d96f ("powerpc/kexec_file: Enable early kernel OPAL calls") Signed-off-by: Zhang Zekun --- arch/powerpc/kexec/file_loa

[PATCH] ocxl: Remove the unused declarations in headr file

2024-09-07 Thread Zhang Zekun
The definition of ocxl_create_cdev() and ocxl_destroy_cdev() has been removed since commit 75ca758adbaf ("ocxl: Create a clear delineation between ocxl backend & frontend"). So, let's remove the empty declarations. Signed-off-by: Zhang Zekun --- drivers/misc/ocxl/ocxl_intern

[PATCH 1/2] powerpc/powermac/pfunc_base: Use helper function for_each_child_of_node()

2024-08-22 Thread Zhang Zekun
for_each_child_of_node() can help to iterate through the device_node, and we don't need to do it manually. No functional change with this conversion. Signed-off-by: Zhang Zekun --- arch/powerpc/platforms/powermac/pfunc_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --

[PATCH 2/2] powerpc/pseries/dlpar: Use helper function for_each_child_of_node()

2024-08-22 Thread Zhang Zekun
for_each_child_of_node can help to iterate through the device_node, and we don't need to use while loop. No functional change with this conversion. Signed-off-by: Zhang Zekun --- arch/powerpc/platforms/pseries/dlpar.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a

[PATCH 0/2] Use helper function for_each_child_of_node()

2024-08-22 Thread Zhang Zekun
Use for_each_child_of_node() to iterate through the device_node, this can make code more simple. Zhang Zekun (2): powerpc/powermac/pfunc_base: Use helper function for_each_child_of_node() powerpc/pseries/dlpar: Use helper function for_each_child_of_node() arch/powerpc/platforms/powermac