diff mbox

[U-Boot,1/1] x86: ivybridge: remove unused uma_memory_size

Message ID 20170730191726.18187-1-xypron.glpk@gmx.de
State Accepted
Commit 6461f45b7194b4b345e2f5991c3f75c5ed36f238
Delegated to: Bin Meng
Headers show

Commit Message

Heinrich Schuchardt July 30, 2017, 7:17 p.m. UTC
The value of uma_memory_size depends on an undefined value
from the stack. The value of uma_memory_size is changed but
never used.

So simply remove this superfluous code.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 arch/x86/cpu/ivybridge/sdram.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Bin Meng July 30, 2017, 10:25 p.m. UTC | #1
On Mon, Jul 31, 2017 at 3:17 AM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> The value of uma_memory_size depends on an undefined value
> from the stack. The value of uma_memory_size is changed but
> never used.
>
> So simply remove this superfluous code.
>
> The problem was indicated by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  arch/x86/cpu/ivybridge/sdram.c | 5 -----
>  1 file changed, 5 deletions(-)
>

Good catch!

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Aug. 1, 2017, 9:12 a.m. UTC | #2
On 30 July 2017 at 13:17, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> The value of uma_memory_size depends on an undefined value
> from the stack. The value of uma_memory_size is changed but
> never used.
>
> So simply remove this superfluous code.
>
> The problem was indicated by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  arch/x86/cpu/ivybridge/sdram.c | 5 -----
>  1 file changed, 5 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Bin Meng Aug. 1, 2017, 12:24 p.m. UTC | #3
On Tue, Aug 1, 2017 at 5:12 PM, Simon Glass <sjg@chromium.org> wrote:
> On 30 July 2017 at 13:17, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>> The value of uma_memory_size depends on an undefined value
>> from the stack. The value of uma_memory_size is changed but
>> never used.
>>
>> So simply remove this superfluous code.
>>
>> The problem was indicated by cppcheck.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>>  arch/x86/cpu/ivybridge/sdram.c | 5 -----
>>  1 file changed, 5 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index 643d804e35..1cdbe479fd 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -233,7 +233,6 @@  static int sdram_find(struct udevice *dev)
 	uint32_t tseg_base, uma_size, tolud;
 	uint64_t tom, me_base, touud;
 	uint64_t uma_memory_base = 0;
-	uint64_t uma_memory_size;
 	unsigned long long tomk;
 	uint16_t ggc;
 	u32 val;
@@ -298,7 +297,6 @@  static int sdram_find(struct udevice *dev)
 		tolud += uma_size << 10;
 		/* UMA starts at old TOLUD */
 		uma_memory_base = tomk * 1024ULL;
-		uma_memory_size = uma_size * 1024ULL;
 		debug("ME UMA base %llx size %uM\n", me_base, uma_size >> 10);
 	}
 
@@ -312,13 +310,11 @@  static int sdram_find(struct udevice *dev)
 		debug("%uM UMA", uma_size >> 10);
 		tomk -= uma_size;
 		uma_memory_base = tomk * 1024ULL;
-		uma_memory_size += uma_size * 1024ULL;
 
 		/* GTT Graphics Stolen Memory Size (GGMS) */
 		uma_size = ((ggc >> 8) & 0x3) * 1024ULL;
 		tomk -= uma_size;
 		uma_memory_base = tomk * 1024ULL;
-		uma_memory_size += uma_size * 1024ULL;
 		debug(" and %uM GTT\n", uma_size >> 10);
 	}
 
@@ -327,7 +323,6 @@  static int sdram_find(struct udevice *dev)
 	uma_size = (uma_memory_base - tseg_base) >> 10;
 	tomk -= uma_size;
 	uma_memory_base = tomk * 1024ULL;
-	uma_memory_size += uma_size * 1024ULL;
 	debug("TSEG base 0x%08x size %uM\n", tseg_base, uma_size >> 10);
 
 	debug("Available memory below 4GB: %lluM\n", tomk >> 10);