Skip to content

Commit 977c4b2

Browse files
Shawnshhlijinxia
authored andcommitted
fix parted of "missing for discarded return value"
MISRA C required that return value should be used, missing for it should add "(void)" prefix before the function call. Some function can be declared without return value to avoid this problem. Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent b8bdf17 commit 977c4b2

File tree

24 files changed

+46
-63
lines changed

24 files changed

+46
-63
lines changed

hypervisor/arch/x86/assign.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ static void get_entry_info(struct ptdev_remapping_info *entry, char *type,
967967
}
968968
}
969969

970-
int get_ptdev_info(char *str, int str_max)
970+
void get_ptdev_info(char *str, int str_max)
971971
{
972972
struct ptdev_remapping_info *entry;
973973
int len, size = str_max;
@@ -1014,5 +1014,4 @@ int get_ptdev_info(char *str, int str_max)
10141014
spinlock_release(&ptdev_lock);
10151015

10161016
snprintf(str, size, "\r\n");
1017-
return 0;
10181017
}

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ int shutdown_vcpu(__unused struct vcpu *vcpu)
237237
return 0;
238238
}
239239

240-
int destroy_vcpu(struct vcpu *vcpu)
240+
void destroy_vcpu(struct vcpu *vcpu)
241241
{
242242
ASSERT(vcpu != NULL, "Incorrect arguments");
243243

@@ -254,8 +254,6 @@ int destroy_vcpu(struct vcpu *vcpu)
254254
per_cpu(ever_run_vcpu, vcpu->pcpu_id) = NULL;
255255
free_pcpu(vcpu->pcpu_id);
256256
free(vcpu);
257-
258-
return 0;
259257
}
260258

261259
/* NOTE:

hypervisor/arch/x86/guest/vioapic.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ bool vioapic_get_rte(struct vm *vm, int pin, void *rte)
606606
return false;
607607
}
608608

609-
int get_vioapic_info(char *str, int str_max, int vmid)
609+
void get_vioapic_info(char *str, int str_max, int vmid)
610610
{
611611
int pin, len, size = str_max, vector, delmode;
612612
uint64_t rte;
@@ -650,5 +650,4 @@ int get_vioapic_info(char *str, int str_max, int vmid)
650650
}
651651
END:
652652
snprintf(str, size, "\r\n");
653-
return 0;
654653
}

hypervisor/arch/x86/guest/vm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,20 +260,18 @@ int start_vm(struct vm *vm)
260260
* DM only pause vm for shutdown/reboot. If we need to
261261
* extend the pause vm for DM, this API should be extended.
262262
*/
263-
int pause_vm(struct vm *vm)
263+
void pause_vm(struct vm *vm)
264264
{
265265
int i;
266266
struct vcpu *vcpu = NULL;
267267

268268
if (vm->state == VM_PAUSED)
269-
return 0;
269+
return;
270270

271271
vm->state = VM_PAUSED;
272272

273273
foreach_vcpu(i, vm, vcpu)
274274
pause_vcpu(vcpu, VCPU_ZOMBIE);
275-
276-
return 0;
277275
}
278276

279277
int vm_resume(struct vm *vm)

hypervisor/arch/x86/interrupt.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static bool vcpu_pending_request(struct vcpu *vcpu)
9494
return vcpu->arch_vcpu.pending_req != 0;
9595
}
9696

97-
int vcpu_make_request(struct vcpu *vcpu, int eventid)
97+
void vcpu_make_request(struct vcpu *vcpu, int eventid)
9898
{
9999
bitmap_set(eventid, &vcpu->arch_vcpu.pending_req);
100100
/*
@@ -108,8 +108,6 @@ int vcpu_make_request(struct vcpu *vcpu, int eventid)
108108
*/
109109
if ((int)get_cpu_id() != vcpu->pcpu_id)
110110
send_single_ipi(vcpu->pcpu_id, VECTOR_NOTIFY_VCPU);
111-
112-
return 0;
113111
}
114112

115113
static int vcpu_do_pending_event(struct vcpu *vcpu)
@@ -223,7 +221,8 @@ int vcpu_queue_exception(struct vcpu *vcpu, uint32_t vector,
223221
if (prev_vector == IDT_DF &&
224222
new_class != EXCEPTION_CLASS_BENIGN) {
225223
/* triple fault happen - shutdwon mode */
226-
return vcpu_make_request(vcpu, ACRN_REQUEST_TRP_FAULT);
224+
vcpu_make_request(vcpu, ACRN_REQUEST_TRP_FAULT);
225+
return 0;
227226
} else if ((prev_class == EXCEPTION_CLASS_CONT &&
228227
new_class == EXCEPTION_CLASS_CONT) ||
229228
(prev_class == EXCEPTION_CLASS_PF &&
@@ -281,20 +280,21 @@ static int vcpu_inject_lo_exception(struct vcpu *vcpu)
281280
return 0;
282281
}
283282

284-
int vcpu_inject_extint(struct vcpu *vcpu)
283+
void vcpu_inject_extint(struct vcpu *vcpu)
285284
{
286-
return vcpu_make_request(vcpu, ACRN_REQUEST_EXTINT);
285+
vcpu_make_request(vcpu, ACRN_REQUEST_EXTINT);
287286
}
288287

289-
int vcpu_inject_nmi(struct vcpu *vcpu)
288+
void vcpu_inject_nmi(struct vcpu *vcpu)
290289
{
291-
return vcpu_make_request(vcpu, ACRN_REQUEST_NMI);
290+
vcpu_make_request(vcpu, ACRN_REQUEST_NMI);
292291
}
293292

294293
int vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code)
295294
{
296295
vcpu_queue_exception(vcpu, IDT_GP, err_code);
297-
return vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
296+
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
297+
return 0;
298298
}
299299

300300
int vcpu_inject_pf(struct vcpu *vcpu, uint64_t addr, uint32_t err_code)
@@ -304,7 +304,8 @@ int vcpu_inject_pf(struct vcpu *vcpu, uint64_t addr, uint32_t err_code)
304304

305305
cur_context->cr2 = addr;
306306
vcpu_queue_exception(vcpu, IDT_PF, err_code);
307-
return vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
307+
vcpu_make_request(vcpu, ACRN_REQUEST_EXCP);
308+
return 0;
308309
}
309310

310311
int interrupt_window_vmexit_handler(struct vcpu *vcpu)

hypervisor/arch/x86/intr_lapic.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,9 @@ void resume_lapic(void)
316316
restore_lapic(&saved_lapic_regs);
317317
}
318318

319-
int send_lapic_eoi(void)
319+
void send_lapic_eoi(void)
320320
{
321321
write_lapic_reg32(LAPIC_EOI_REGISTER, 0);
322-
return 0;
323322
}
324323

325324
static void wait_for_delivery(void)

hypervisor/arch/x86/irq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ pri_register_handler(uint32_t irq,
686686
return common_register_handler(irq, &info);
687687
}
688688

689-
int get_cpu_interrupt_info(char *str, int str_max)
689+
void get_cpu_interrupt_info(char *str, int str_max)
690690
{
691691
int pcpu_id;
692692
uint32_t irq, vector, len, size = str_max;
@@ -727,5 +727,4 @@ int get_cpu_interrupt_info(char *str, int str_max)
727727
}
728728
}
729729
snprintf(str, size, "\r\n");
730-
return 0;
731730
}

hypervisor/arch/x86/timer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void timer_cleanup(void)
171171
per_cpu(timer_node, pcpu_id) = NULL;
172172
}
173173

174-
int timer_softirq(int pcpu_id)
174+
void timer_softirq(int pcpu_id)
175175
{
176176
struct per_cpu_timers *cpu_timer;
177177
struct timer *timer;
@@ -207,7 +207,6 @@ int timer_softirq(int pcpu_id)
207207

208208
/* update nearest timer */
209209
update_physical_timer(cpu_timer);
210-
return 0;
211210
}
212211

213212
void check_tsc(void)

hypervisor/arch/x86/vtd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,20 +649,18 @@ static void dmar_set_root_table(struct dmar_drhd_rt *dmar_uint)
649649
IOMMU_UNLOCK(dmar_uint);
650650
}
651651

652-
static int dmar_fault_event_mask(struct dmar_drhd_rt *dmar_uint)
652+
static void dmar_fault_event_mask(struct dmar_drhd_rt *dmar_uint)
653653
{
654654
IOMMU_LOCK(dmar_uint);
655655
iommu_write32(dmar_uint, DMAR_FECTL_REG, DMA_FECTL_IM);
656656
IOMMU_UNLOCK(dmar_uint);
657-
return 0;
658657
}
659658

660-
static int dmar_fault_event_unmask(struct dmar_drhd_rt *dmar_uint)
659+
static void dmar_fault_event_unmask(struct dmar_drhd_rt *dmar_uint)
661660
{
662661
IOMMU_LOCK(dmar_uint);
663662
iommu_write32(dmar_uint, DMAR_FECTL_REG, 0);
664663
IOMMU_UNLOCK(dmar_uint);
665-
return 0;
666664
}
667665

668666
static void dmar_fault_msi_write(struct dmar_drhd_rt *dmar_uint,

hypervisor/common/hv_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int hv_main(int cpu_id)
141141
return 0;
142142
}
143143

144-
int get_vmexit_profile(char *str, int str_max)
144+
void get_vmexit_profile(char *str, int str_max)
145145
{
146146
int cpu, i, len, size = str_max;
147147

@@ -173,5 +173,4 @@ int get_vmexit_profile(char *str, int str_max)
173173
}
174174
}
175175
snprintf(str, size, "\r\n");
176-
return 0;
177176
}

0 commit comments

Comments
 (0)