mirror of https://github.com/xemu-project/xemu.git
usb-linux: only cleanup in host_close when host_open was successful.
This commit is contained in:
parent
97f8616648
commit
1f45a81bef
|
@ -1158,9 +1158,9 @@ static int usb_host_open(USBHostDevice *dev, int bus_num,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
if (dev->fd != -1) {
|
||||||
|
close(dev->fd);
|
||||||
dev->fd = -1;
|
dev->fd = -1;
|
||||||
if (fd != -1) {
|
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1169,7 @@ static int usb_host_close(USBHostDevice *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dev->fd == -1) {
|
if (dev->fd == -1 || !dev->dev.attached) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue