Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673914 > unrolled thread

[PATCH] x86: xen: remove unnecessary variable in xen_foreach_remap_area()

Started by"Gustavo A. R. Silva" <garsilva@embeddedor.com>
First post2017-06-24 00:10 +0200
Last post2017-07-03 13:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86: xen: remove unnecessary variable in  xen_foreach_remap_area() "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-24 00:10 +0200
    Re: [PATCH] x86: xen: remove unnecessary variable in  xen_foreach_remap_area() Juergen Groß <jgross@suse.com> - 2017-06-26 14:00 +0200
    Re: [PATCH] x86: xen: remove unnecessary variable in  xen_foreach_remap_area() Juergen Gross <jgross@suse.com> - 2017-07-03 13:30 +0200

#1673914 — [PATCH] x86: xen: remove unnecessary variable in xen_foreach_remap_area()

From"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date2017-06-24 00:10 +0200
Subject[PATCH] x86: xen: remove unnecessary variable in xen_foreach_remap_area()
Message-ID<tVEW6-7RD-17@gated-at.bofh.it>
Remove unnecessary variable mfn in function xen_foreach_remap_area() and,
refactor the code.

Variable mfn at line 518:mfn = xen_remap_buf.mfns[i];
is only being used to store a value to be passed as
an argument to the xen_update_mem_tables() function.
This value can be passed directly, which makes variable
mfn unnecessary. Also, value assigned to variable mfn
at line 534:mfn = xen_remap_mfn; is never used.

Addresses-Coverity-ID: 1260110
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 arch/x86/xen/setup.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index a5bf7c4..c810463 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -499,7 +499,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages,
 void __init xen_remap_memory(void)
 {
 	unsigned long buf = (unsigned long)&xen_remap_buf;
-	unsigned long mfn_save, mfn, pfn;
+	unsigned long mfn_save, pfn;
 	unsigned long remapped = 0;
 	unsigned int i;
 	unsigned long pfn_s = ~0UL;
@@ -515,8 +515,7 @@ void __init xen_remap_memory(void)
 
 		pfn = xen_remap_buf.target_pfn;
 		for (i = 0; i < xen_remap_buf.size; i++) {
-			mfn = xen_remap_buf.mfns[i];
-			xen_update_mem_tables(pfn, mfn);
+			xen_update_mem_tables(pfn, xen_remap_buf.mfns[i]);
 			remapped++;
 			pfn++;
 		}
@@ -530,8 +529,6 @@ void __init xen_remap_memory(void)
 			pfn_s = xen_remap_buf.target_pfn;
 			len = xen_remap_buf.size;
 		}
-
-		mfn = xen_remap_mfn;
 		xen_remap_mfn = xen_remap_buf.next_area_mfn;
 	}
 
-- 
2.5.0

[toc] | [next] | [standalone]


#1674649

FromJuergen Groß <jgross@suse.com>
Date2017-06-26 14:00 +0200
Message-ID<tWAQp-1Ty-1@gated-at.bofh.it>
In reply to#1673914
On 06/24/2017 12:01 AM, Gustavo A. R. Silva wrote:
> Remove unnecessary variable mfn in function xen_foreach_remap_area() and,
> refactor the code.
> 
> Variable mfn at line 518:mfn = xen_remap_buf.mfns[i];
> is only being used to store a value to be passed as
> an argument to the xen_update_mem_tables() function.
> This value can be passed directly, which makes variable
> mfn unnecessary. Also, value assigned to variable mfn
> at line 534:mfn = xen_remap_mfn; is never used.
> 
> Addresses-Coverity-ID: 1260110
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Thanks,

Juergen

[toc] | [prev] | [next] | [standalone]


#1679909

FromJuergen Gross <jgross@suse.com>
Date2017-07-03 13:30 +0200
Message-ID<tZ7Ie-Fp-7@gated-at.bofh.it>
In reply to#1673914
On 24/06/17 00:01, Gustavo A. R. Silva wrote:
> Remove unnecessary variable mfn in function xen_foreach_remap_area() and,
> refactor the code.
> 
> Variable mfn at line 518:mfn = xen_remap_buf.mfns[i];
> is only being used to store a value to be passed as
> an argument to the xen_update_mem_tables() function.
> This value can be passed directly, which makes variable
> mfn unnecessary. Also, value assigned to variable mfn
> at line 534:mfn = xen_remap_mfn; is never used.
> 
> Addresses-Coverity-ID: 1260110
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Queued to xen/tip.git for-linus-4.13


Thanks,

Juergen

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web