Skip to contentSkip to conversation

arch/x86/kernel/tsc_sync.c: Clean up code by removing unused assignment

PATCH Applied [email protected] 2 participants 2 messages Jan 18, 2020 – Jan 22, 2020 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/x86/kernel/tsc_sync.c: Clean up code by removing unused assignment

From: Mateusz Nosek <[email protected]>

Previously the assignment to local variable 'now' took place before the for loop. The loop is unconditional so it will be entered at least once. The variable 'now' is reassigned in the loop and is not used before reassigning. Therefore the assignment before the loop is unnecessary and can be removed.

---
 arch/x86/kernel/tsc_sync.c | 1 -
 1 file changed, 1 deletion(-)
arch/x86/kernel/tsc_sync.c +0 -1
index b8acf639abd1..32a818764e03 100644
@@ -233,7 +233,6 @@ static cycles_t check_tsc_warp(unsigned int timeout)
 	 * The measurement runs for 'timeout' msecs:
 	 */
 	end = start + (cycles_t) tsc_khz * timeout;
-	now = start;
 
 	for (i = 0; ; i++) {
 		/*
Signature · 1 line
2.17.1
merge bot Applied
#1 lore raw

[tip: x86/cleanups] x86/tsc: Remove redundant assignment

The following commit has been merged into the x86/cleanups branch of tip:

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     4144fddbd3932b59370e6e279002991c3e2b2fc6
Gitweb:        https://git.kernel.org/tip/4144fddbd3932b59370e6e279002991c3e2b2fc6
Author:        Mateusz Nosek <[email protected]>
AuthorDate:    Sat, 18 Jan 2020 18:11:43 +01:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Wed, 22 Jan 2020 13:52:42 +01:00

x86/tsc: Remove redundant assignment

Previously, the assignment to the local variable 'now' took place before the for loop. The loop is unconditional so it will be entered at least once. The variable 'now' is reassigned in the loop and is not used before reassigning. Therefore, the assignment before the loop is unnecessary and can be removed.

No code changed:

# arch/x86/kernel/tsc_sync.o:

   text    data     bss     dec     hex filename
   3569     198      44    3811     ee3 tsc_sync.o.before
   3569     198      44    3811     ee3 tsc_sync.o.after

md5:
36216de29b208edbcd34fed9fe7f7b69 tsc_sync.o.before.asm 36216de29b208edbcd34fed9fe7f7b69 tsc_sync.o.after.asm

[ bp: Massage commit message. ]

---
 arch/x86/kernel/tsc_sync.c | 1 -
 1 file changed, 1 deletion(-)
arch/x86/kernel/tsc_sync.c +0 -1
index b8acf63..32a8187 100644
@@ -233,7 +233,6 @@ static cycles_t check_tsc_warp(unsigned int timeout)
 	 * The measurement runs for 'timeout' msecs:
 	 */
 	end = start + (cycles_t) tsc_khz * timeout;
-	now = start;
 
 	for (i = 0; ; i++) {
 		/*