uhci: initialize expire_time when loading v1 vmstate
$subject says all: when loading old (v1) vmstate which doesn't contain expire_time initialize it with a reasonable default (current time). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
0f58f68b58
commit
75f151cd27
@ -388,11 +388,23 @@ static const VMStateDescription vmstate_uhci_port = {
|
||||
}
|
||||
};
|
||||
|
||||
static int uhci_post_load(void *opaque, int version_id)
|
||||
{
|
||||
UHCIState *s = opaque;
|
||||
|
||||
if (version_id < 2) {
|
||||
s->expire_time = qemu_get_clock_ns(vm_clock) +
|
||||
(get_ticks_per_sec() / FRAME_TIMER_FREQ);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_uhci = {
|
||||
.name = "uhci",
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 1,
|
||||
.minimum_version_id_old = 1,
|
||||
.post_load = uhci_post_load,
|
||||
.fields = (VMStateField []) {
|
||||
VMSTATE_PCI_DEVICE(dev, UHCIState),
|
||||
VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState),
|
||||
|
Loading…
Reference in New Issue
Block a user