* [PATCH v2] arm: mm: (cache-feroceon-l2) Add missing of_node_put()
@ 2022-06-16 3:02 Liang He
2022-06-18 11:36 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-16 3:02 UTC (permalink / raw)
To: linux; +Cc: windhl, linux-arm-kernel, linux-kernel
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.
Signed-off-by: Liang He <windhl@126.com>
---
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(-)
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
index 5c1b7a7b9af6..ff17b7df4b09 100644
--- a/arch/arm/mm/cache-feroceon-l2.c
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -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
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] arm: mm: (cache-feroceon-l2) Add missing of_node_put()
2022-06-16 3:02 [PATCH v2] arm: mm: (cache-feroceon-l2) Add missing of_node_put() Liang He
@ 2022-06-18 11:36 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-06-18 11:36 UTC (permalink / raw)
To: Liang He, linux; +Cc: llvm, kbuild-all, windhl, linux-arm-kernel, linux-kernel
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/202206181916.KzyEh57x-lkp@intel.com/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
Reported-by: kernel test robot <lkp@intel.com>
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;
--
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-18 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-16 3:02 [PATCH v2] arm: mm: (cache-feroceon-l2) Add missing of_node_put() Liang He
2022-06-18 11:36 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).