arch: powerpc/kexec: Add missing of_node-put() in default_machine_kexec_prepare()
PATCH v2 1/2 arch: powerpc/kexec: Add missing of_node-put() in default_machine_kexec_prepare()
In reply to a message not in the archiveDecrement the reference count on device_node "node" while breaking out of the loop. Issue identified by Coccinelle.
---
Changes in V2:
- Change subject line
--- arch/powerpc/kernel/machine_kexec_64.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/machine_kexec_64.c +1 -0
@@ -65,6 +65,7 @@ int default_machine_kexec_prepare(struct kimage *image) end = begin + image->segment[i].memsz;if ((begin < high) && (end > low)) +of_node_put (node);return -ETXTBSY ; } }
Signature · 1 line
2.17.1
PATCH v2 2/2 arch: powerpc/hlwd-pic: Add missing of_node-put() in hlwd_pic_probe()
Decrement the reference count on device_node "np" while breaking out of the loop. Issue identified by Coccinelle.
---
Changes in V2:
- Change subject line
--- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/embedded6xx/hlwd-pic.c +1 -1
@@ -220,6 +220,7 @@ void hlwd_pic_probe(void)irq_set_chained_handler (cascade_virq, hlwd_pic_irq_cascade); hlwd_irq_host = host; +of_node_put (np);break ; } }
@@ -237,4 +238,3 @@ void hlwd_quiesce(void)__hlwd_quiesce (io_base); } -
Signature · 1 line
2.17.1
kbuild test robot
build botThank you for the patch! Perhaps something to improve:
Hi Himadri,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.0-rc8 next-20190225]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Himadri-Pandya/arch-powerpc-kexec-Add-missing-of_node-put-in-default_machine_kexec_prepare/20190225-233822 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-allyesconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.2.0 make.cross ARCH=powerpc
All warnings (new ones prefixed by >>):
arch/powerpc/kernel/machine_kexec_64.c: In function 'default_machine_kexec_prepare':
>> arch/powerpc/kernel/machine_kexec_64.c:67:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if ((begin < high) && (end > low))
^~
arch/powerpc/kernel/machine_kexec_64.c:69:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
return -ETXTBSY;
^~~~~~vim +/if +67 arch/powerpc/kernel/machine_kexec_64.c
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 34
3d1229d6 arch/powerpc/kernel/machine_kexec_64.c Michael Ellerman 2005-11-14 35 int default_machine_kexec_prepare(struct kimage *image)
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 36 {
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 37 int i;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 38 unsigned long begin, end; /* limits of segment */
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 39 unsigned long low, high; /* limits of blocked memory range */
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 40 struct device_node *node;
a7f67bdf arch/powerpc/kernel/machine_kexec_64.c Jeremy Kerr 2006-07-12 41 const unsigned long *basep;
a7f67bdf arch/powerpc/kernel/machine_kexec_64.c Jeremy Kerr 2006-07-12 42 const unsigned int *sizep;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 43
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 44 /*
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 45 * Since we use the kernel fault handlers and paging code to
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 46 * handle the virtual mode, we must make sure no destination
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 47 * overlaps kernel static data or bss.
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 48 */
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 49 for (i = 0; i < image->nr_segments; i++)
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 50 if (image->segment[i].mem < __pa(_end))
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 51 return -ETXTBSY;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 52
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 53 /* We also should not overwrite the tce tables */
94db7c5e arch/powerpc/kernel/machine_kexec_64.c Anton Blanchard 2011-08-10 54 for_each_node_by_type(node, "pci") {
e2eb6392 arch/powerpc/kernel/machine_kexec_64.c Stephen Rothwell 2007-04-03 55 basep = of_get_property(node, "linux,tce-base", NULL);
e2eb6392 arch/powerpc/kernel/machine_kexec_64.c Stephen Rothwell 2007-04-03 56 sizep = of_get_property(node, "linux,tce-size", NULL);
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 57 if (basep == NULL || sizep == NULL)
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 58 continue;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 59
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 60 low = *basep;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 61 high = low + (*sizep);
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 62
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 63 for (i = 0; i < image->nr_segments; i++) {
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 64 begin = image->segment[i].mem;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 65 end = begin + image->segment[i].memsz;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 66
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 @67 if ((begin < high) && (end > low))
bd754146 arch/powerpc/kernel/machine_kexec_64.c Himadri Pandya 2019-02-25 68 of_node_put(node);
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 69 return -ETXTBSY;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 70 }
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 71 }
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 72
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 73 return 0;
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 74 }
fce0d574 arch/ppc64/kernel/machine_kexec.c R Sharada 2005-06-25 75 :::::: The code at line 67 was first introduced by commit
:::::: fce0d5740322b98b863f9e609f5a9bd4c06703af [PATCH] ppc64: kexec support for ppc64
:::::: TO: R Sharada <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Quoted 16 lines · Himadri Pandya
Decrement the reference count on
device_node"node" while breaking out of the loop. Issue identified by Coccinelle.Signed-off-by Himadri Pandya <[email protected]>---
Changes in V2:
- Change subject line--- arch/powerpc/kernel/machine_kexec_64.c | 1 + 1 file changed, 1 insertion(+)arch/powerpc/kernel/machine_kexec_64.c +0
-0
arch/powerpc/kernel/machine_kexec_64.c int default_machine_kexec_prepare(struct kimage *image) · line 69
Quoted 5 lines
arch/powerpc/kernel/machine_kexec_64.c +1
-0@@ -65,6 +65,7 @@ int default_machine_kexec_prepare(struct kimage *image) end = begin + image->segment[i].memsz;if ((begin < high) && (end > low)) +of_node_put (node);return -ETXTBSY ;
I think the kbuild robot already caught this, but you need to add { } block around this if now. Previously it was a one line statement, but adding the of_node_put() makes it multiple lines that now require { }.
-Tyrel
Quoted 3 lines
arch/powerpc/kernel/machine_kexec_64.c +0
-0} }
Re: [PATCH v2 2/2] arch: powerpc/hlwd-pic: Add missing of_node-put() in hlwd_pic_probe()
In reply to Himadri PandyaQuoted 25 lines · Himadri Pandya
Decrement the reference count on
device_node"np" while breaking out of the loop. Issue identified by Coccinelle.Signed-off-by Himadri Pandya <[email protected]>---
Changes in V2:
- Change subject line--- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/platforms/embedded6xx/hlwd-pic.c +1
-0@@ -220,6 +220,7 @@ void hlwd_pic_probe(void)irq_set_chained_handler (cascade_virq, hlwd_pic_irq_cascade); hlwd_irq_host = host; +of_node_put (np);break ; } }
arch/powerpc/platforms/embedded6xx/hlwd-pic.c void hlwd_quiesce(void) · line 240
Quoted 4 lines
arch/powerpc/platforms/embedded6xx/hlwd-pic.c +0
-1@@ -237,4 +238,3 @@ void hlwd_quiesce(void)__hlwd_quiesce (io_base); } -
This line removal at the end of the patch is likely accidental, but really should not be here. Otherwise,
PATCH v3 1/2 arch: powerpc/kexec: Add missing of_node-put() in default_machine_kexec_prepare()
In reply to Himadri PandyaDecrement the reference count on device_node "node" while breaking out of the loop. Issue identified by Coccinelle.
---
Changes in V2:
- Change subject line
---
Changes in V3:
- Add braces around the if block
--- arch/powerpc/kernel/machine_kexec_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/machine_kexec_64.c +3 -1
@@ -64,8 +64,10 @@ int default_machine_kexec_prepare(struct kimage *image) begin = image->segment[i].mem; end = begin + image->segment[i].memsz; -if ((begin < high) && (end > low)) +if ((begin < high) && (end > low)) { +of_node_put (node);return -ETXTBSY ; + } } }
Signature · 1 line
2.17.1
PATCH v3 2/2 arch: powerpc/hlwd-pic: Add missing of_node-put() in hlwd_pic_probe()
Decrement the reference count on device_node "np" while breaking out of the loop. Issue identified by Coccinelle.
---
Changes in V2:
- Change subject line
---
Changes in V3:
- Do not remove the blank line at end of the file
--- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/platforms/embedded6xx/hlwd-pic.c +2 -1
@@ -220,6 +220,7 @@ void hlwd_pic_probe(void)irq_set_chained_handler (cascade_virq, hlwd_pic_irq_cascade); hlwd_irq_host = host; +of_node_put (np);break ; } }
@@ -232,7 +233,7 @@ void hlwd_pic_probe(void)* */ void hlwd_quiesce (void ) -{ +{i void __iomem *io_base = hlwd_irq_host->host_data;__hlwd_quiesce (io_base);
Signature · 1 line
2.17.1