arm: mm: (cache-feroceon-l2) Add missing of_node_put()
PATCH v2 1/1 arm: mm: (cache-feroceon-l2) Add missing of_node_put()
In feroceon_of_init(), of_find_matching_node() will return a node pointer with refcount incremented. We should use of_node_put() in fail path or when it is not used anymore.
---
changelog:
v2: (1) use real name (2) fix errors reported by with scritps/checkpatch.pl
(3) use goto-label patch style
v1: add of_node_put() in fail path
arch/arm/mm/cache-feroceon-l2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mm/cache-feroceon-l2.c +9 -3
@@ -368,6 +368,7 @@ int __init feroceon_of_init(void)struct device_node *node;void __iomem *base;bool l2_wt_override = false; +int ret;#if defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH ) l2_wt_override = true;
@@ -376,8 +377,10 @@ int __init feroceon_of_init(void) node =of_find_matching_node (NULL , feroceon_ids);if (node &&of_device_is_compatible (node,"marvell,kirkwood-cache" )) { base =of_iomap (node,0 ); -if (!base) -return -ENOMEM ; +if (!base) { + ret = -ENOMEM ; + goto out_put; + }if (l2_wt_override)writel (readl (base) |L2_WRITETHROUGH_KIRKWOOD , base);
@@ -386,7 +389,10 @@ int __init feroceon_of_init(void) }feroceon_l2_init (l2_wt_override); + ret =0 ; -return 0 ; +output: +of_node_put (node); +return ret; }#endif
Signature · 1 line
2.25.1
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Liang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on arm/for-next]
[also build test ERROR on arm64/for-next/core clk/clk-next kvmarm/next rockchip/for-next shawnguo/for-next soc/for-next xilinx-xlnx/master linus/master keystone/next v5.19-rc2 next-20220617] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Liang-He/arm-mm-cache-feroceon-l2-Add-missing-of_node_put/20220616-110418 base: git://git.armlinux.org.uk/~rmk/linux-arm.git for-next config: arm-mv78xx0_defconfig (https://download.01.org/0day-ci/archive/20220618/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 91688716ba49942051dccdf7b9c4f81a7ec8feaf)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/bfe3f64dcc525721223aeb2d18594832ac9273c5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Liang-He/arm-mm-cache-feroceon-l2-Add-missing-of_node_put/20220616-110418 git checkout bfe3f64dcc525721223aeb2d18594832ac9273c5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
All errors (new ones prefixed by >>):
>> arch/arm/mm/cache-feroceon-l2.c:382:9: error: use of undeclared label 'out_put'
goto out_put;
^1 error generated.
vim +/out_put +382 arch/arm/mm/cache-feroceon-l2.c
376
377 node = of_find_matching_node(NULL, feroceon_ids);
378 if (node && of_device_is_compatible(node, "marvell,kirkwood-cache")) {
379 base = of_iomap(node, 0);
380 if (!base) {
381 ret = -ENOMEM;
> 382 goto out_put;
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp