public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mtrr: Remove redundant code
@ 2023-10-18  7:41 Jiapeng Chong
  2023-10-18  8:41 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-10-18  7:41 UTC (permalink / raw)
  To: tglx
  Cc: mingo, bp, dave.hansen, x86, hpa, jgross, linux-kernel,
	Jiapeng Chong, Abaci Robot

arch/x86/kernel/cpu/mtrr/cleanup.c:943:4: warning: Value stored to 'highest_pfn' is never read.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6912
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 arch/x86/kernel/cpu/mtrr/cleanup.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
index 18cf79d6e2c5..c4ec295cebbc 100644
--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
+++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
@@ -939,8 +939,6 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
 	if (mtrr_tom2) {
 		range[nr_range].start = (1ULL<<(32 - PAGE_SHIFT));
 		range[nr_range].end = mtrr_tom2 >> PAGE_SHIFT;
-		if (highest_pfn < range[nr_range].end)
-			highest_pfn = range[nr_range].end;
 		nr_range++;
 	}
 	nr_range = x86_get_mtrr_mem_range(range, nr_range, 0, 0);
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/mtrr: Remove redundant code
  2023-10-18  7:41 [PATCH] x86/mtrr: Remove redundant code Jiapeng Chong
@ 2023-10-18  8:41 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2023-10-18  8:41 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, jgross, linux-kernel,
	Abaci Robot


* Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:

> arch/x86/kernel/cpu/mtrr/cleanup.c:943:4: warning: Value stored to 'highest_pfn' is never read.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6912
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  arch/x86/kernel/cpu/mtrr/cleanup.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
> index 18cf79d6e2c5..c4ec295cebbc 100644
> --- a/arch/x86/kernel/cpu/mtrr/cleanup.c
> +++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
> @@ -939,8 +939,6 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
>  	if (mtrr_tom2) {
>  		range[nr_range].start = (1ULL<<(32 - PAGE_SHIFT));
>  		range[nr_range].end = mtrr_tom2 >> PAGE_SHIFT;
> -		if (highest_pfn < range[nr_range].end)
> -			highest_pfn = range[nr_range].end;
>  		nr_range++;
>  	}
>  	nr_range = x86_get_mtrr_mem_range(range, nr_range, 0, 0);

Please explain in the changelog how that redundant code got there and why 
there's no underlying bug to be concerned about.

[ I just did that myself and could share the results - but this kind of 
  analysis has to be done when submitting "cleanup" patches changing such 
  type of code ... or at least it has to be flagged, not just mindlessly 
  removing code ... ]

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-18  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18  7:41 [PATCH] x86/mtrr: Remove redundant code Jiapeng Chong
2023-10-18  8:41 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox