Skip to content

Commit 83d1ddc

Browse files
junjunshan1lijinxia
authored andcommitted
hv:Delete the dead code
Delete the dead code get_irq_info(), local_get_irq_info() in io_request.c and definition in guest.h. v1->v2 *the dead code used pointers which not checked before use, therefore it causes "pointer not checked for null before use". To make it clearly, modify the subject to "delete the dead code" directly. *remove dead code local_get_irq_info() in io_request.c and definition in guest.h together. Tracked-On: #861 Signed-off-by: Junjun Shan <junjun.shan@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent c307e1b commit 83d1ddc

File tree

2 files changed

+0
-106
lines changed

2 files changed

+0
-106
lines changed

hypervisor/common/io_request.c

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -100,105 +100,3 @@ acrn_insert_request_wait(struct vcpu *vcpu, struct io_request *io_req)
100100

101101
return 0;
102102
}
103-
104-
#ifdef HV_DEBUG
105-
static void local_get_req_info_(struct vhm_request *req, int *id, char *type,
106-
char *state, char *dir, uint64_t *addr, uint64_t *val)
107-
{
108-
(void)strcpy_s(dir, 16U, "NONE");
109-
*addr = 0UL;
110-
*val = 0UL;
111-
*id = req->client;
112-
113-
switch (req->type) {
114-
case REQ_PORTIO:
115-
(void)strcpy_s(type, 16U, "PORTIO");
116-
if (req->reqs.pio.direction == REQUEST_READ) {
117-
(void)strcpy_s(dir, 16U, "READ");
118-
} else {
119-
(void)strcpy_s(dir, 16U, "WRITE");
120-
}
121-
*addr = req->reqs.pio.address;
122-
*val = req->reqs.pio.value;
123-
break;
124-
case REQ_MMIO:
125-
case REQ_WP:
126-
(void)strcpy_s(type, 16U, "MMIO/WP");
127-
if (req->reqs.mmio.direction == REQUEST_READ) {
128-
(void)strcpy_s(dir, 16U, "READ");
129-
} else {
130-
(void)strcpy_s(dir, 16U, "WRITE");
131-
}
132-
*addr = req->reqs.mmio.address;
133-
*val = req->reqs.mmio.value;
134-
break;
135-
break;
136-
default:
137-
(void)strcpy_s(type, 16U, "UNKNOWN");
138-
}
139-
140-
switch (req->processed) {
141-
case REQ_STATE_COMPLETE:
142-
(void)strcpy_s(state, 16U, "COMPLETE");
143-
break;
144-
case REQ_STATE_PENDING:
145-
(void)strcpy_s(state, 16U, "PENDING");
146-
break;
147-
case REQ_STATE_PROCESSING:
148-
(void)strcpy_s(state, 16U, "PROCESS");
149-
break;
150-
case REQ_STATE_FREE:
151-
(void)strcpy_s(state, 16U, "FREE");
152-
break;
153-
default:
154-
(void)strcpy_s(state, 16U, "UNKNOWN");
155-
}
156-
}
157-
158-
void get_req_info(char *str_arg, int str_max)
159-
{
160-
char *str = str_arg;
161-
uint32_t i;
162-
int32_t len, size = str_max, client_id;
163-
union vhm_request_buffer *req_buf;
164-
struct vhm_request *req;
165-
char type[16], state[16], dir[16];
166-
uint64_t addr, val;
167-
struct list_head *pos;
168-
struct vm *vm;
169-
170-
len = snprintf(str, size,
171-
"\r\nVM\tVCPU\tCID\tTYPE\tSTATE\tDIR\tADDR\t\t\tVAL");
172-
size -= len;
173-
str += len;
174-
175-
spinlock_obtain(&vm_list_lock);
176-
list_for_each(pos, &vm_list) {
177-
vm = list_entry(pos, struct vm, list);
178-
req_buf = (union vhm_request_buffer *)vm->sw.io_shared_page;
179-
if (req_buf != NULL) {
180-
for (i = 0U; i < VHM_REQUEST_MAX; i++) {
181-
req = req_buf->req_queue + i;
182-
if (req->valid != 0) {
183-
local_get_req_info_(req, &client_id, type,
184-
state, dir, &addr, &val);
185-
len = snprintf(str, size,
186-
"\r\n%d\t%d\t%d\t%s\t%s\t%s",
187-
vm->vm_id, i, client_id, type,
188-
state, dir);
189-
size -= len;
190-
str += len;
191-
192-
len = snprintf(str, size,
193-
"\t0x%016llx\t0x%016llx",
194-
addr, val);
195-
size -= len;
196-
str += len;
197-
}
198-
}
199-
}
200-
}
201-
spinlock_release(&vm_list_lock);
202-
snprintf(str, size, "\r\n");
203-
}
204-
#endif /* HV_DEBUG */

hypervisor/include/arch/x86/guest/guest.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ int copy_to_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
142142
uint64_t create_guest_init_gdt(struct vm *vm, uint32_t *limit);
143143
extern uint8_t vm0_boot_context;
144144

145-
#ifdef HV_DEBUG
146-
void get_req_info(char *str_arg, int str_max);
147-
#endif /* HV_DEBUG */
148-
149145
#endif /* !ASSEMBLER */
150146

151147
#endif /* GUEST_H*/

0 commit comments

Comments
 (0)