Skip to content

Commit 14af3f3

Browse files
hharrisonavikivity
authored andcommitted
KVM: sparse fixes for kvm/x86.c
In two case statements, use the ever popular 'i' instead of index: arch/x86/kvm/x86.c:1063:7: warning: symbol 'index' shadows an earlier one arch/x86/kvm/x86.c:1000:9: originally declared here arch/x86/kvm/x86.c:1079:7: warning: symbol 'index' shadows an earlier one arch/x86/kvm/x86.c:1000:9: originally declared here Make it static. arch/x86/kvm/x86.c:1945:24: warning: symbol 'emulate_ops' was not declared. Should it be static? Drop the return statements. arch/x86/kvm/x86.c:2878:2: warning: returning void-valued expression arch/x86/kvm/x86.c:2944:2: warning: returning void-valued expression Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
1 parent 4866d5e commit 14af3f3

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

arch/x86/kvm/x86.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,32 +1083,32 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
10831083
}
10841084
/* function 4 and 0xb have additional index. */
10851085
case 4: {
1086-
int index, cache_type;
1086+
int i, cache_type;
10871087

10881088
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
10891089
/* read more entries until cache_type is zero */
1090-
for (index = 1; *nent < maxnent; ++index) {
1091-
cache_type = entry[index - 1].eax & 0x1f;
1090+
for (i = 1; *nent < maxnent; ++i) {
1091+
cache_type = entry[i - 1].eax & 0x1f;
10921092
if (!cache_type)
10931093
break;
1094-
do_cpuid_1_ent(&entry[index], function, index);
1095-
entry[index].flags |=
1094+
do_cpuid_1_ent(&entry[i], function, i);
1095+
entry[i].flags |=
10961096
KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
10971097
++*nent;
10981098
}
10991099
break;
11001100
}
11011101
case 0xb: {
1102-
int index, level_type;
1102+
int i, level_type;
11031103

11041104
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
11051105
/* read more entries until level_type is zero */
1106-
for (index = 1; *nent < maxnent; ++index) {
1107-
level_type = entry[index - 1].ecx & 0xff;
1106+
for (i = 1; *nent < maxnent; ++i) {
1107+
level_type = entry[i - 1].ecx & 0xff;
11081108
if (!level_type)
11091109
break;
1110-
do_cpuid_1_ent(&entry[index], function, index);
1111-
entry[index].flags |=
1110+
do_cpuid_1_ent(&entry[i], function, i);
1111+
entry[i].flags |=
11121112
KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
11131113
++*nent;
11141114
}
@@ -1965,7 +1965,7 @@ void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context)
19651965
}
19661966
EXPORT_SYMBOL_GPL(kvm_report_emulation_failure);
19671967

1968-
struct x86_emulate_ops emulate_ops = {
1968+
static struct x86_emulate_ops emulate_ops = {
19691969
.read_std = emulator_read_std,
19701970
.read_emulated = emulator_read_emulated,
19711971
.write_emulated = emulator_write_emulated,
@@ -2899,7 +2899,7 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
28992899
static void get_segment(struct kvm_vcpu *vcpu,
29002900
struct kvm_segment *var, int seg)
29012901
{
2902-
return kvm_x86_ops->get_segment(vcpu, var, seg);
2902+
kvm_x86_ops->get_segment(vcpu, var, seg);
29032903
}
29042904

29052905
void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l)
@@ -2965,7 +2965,7 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
29652965
static void set_segment(struct kvm_vcpu *vcpu,
29662966
struct kvm_segment *var, int seg)
29672967
{
2968-
return kvm_x86_ops->set_segment(vcpu, var, seg);
2968+
kvm_x86_ops->set_segment(vcpu, var, seg);
29692969
}
29702970

29712971
int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,

0 commit comments

Comments
 (0)