ccid: Fix crash when backend isn't specified
Reproducer: ./x86_64-softmmu/qemu-system-x86_64 -device usb-ccid,id=ccid0 -usb -device ccid-card-emulated -monitor stdio Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com>
This commit is contained in:
parent
909eedb74f
commit
ae12e3a643
@ -503,9 +503,15 @@ static int emulated_initfn(CCIDCardState *base)
|
||||
if (init_pipe_signaling(card) < 0) {
|
||||
return -1;
|
||||
}
|
||||
card->backend = parse_enumeration(card->backend_str, backend_enum_table, 0);
|
||||
|
||||
card->backend = 0;
|
||||
if (card->backend_str) {
|
||||
card->backend = parse_enumeration(card->backend_str,
|
||||
backend_enum_table, 0);
|
||||
}
|
||||
|
||||
if (card->backend == 0) {
|
||||
printf("unknown backend, must be one of:\n");
|
||||
printf("backend must be one of:\n");
|
||||
for (ptable = backend_enum_table; ptable->name != NULL; ++ptable) {
|
||||
printf("%s\n", ptable->name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user