rust: qdev: support returning errors from realize

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2025-05-23 18:31:29 +02:00
parent 9a33f49f44
commit 4b66abead9
3 changed files with 14 additions and 8 deletions

View file

@ -175,7 +175,7 @@ impl DeviceImpl for PL011State {
fn vmsd() -> Option<&'static VMStateDescription> {
Some(&device_class::VMSTATE_PL011)
}
const REALIZE: Option<fn(&Self)> = Some(Self::realize);
const REALIZE: Option<fn(&Self) -> qemu_api::Result<()>> = Some(Self::realize);
}
impl ResettablePhasesImpl for PL011State {
@ -619,9 +619,10 @@ impl PL011State {
}
}
fn realize(&self) {
fn realize(&self) -> qemu_api::Result<()> {
self.char_backend
.enable_handlers(self, Self::can_receive, Self::receive, Self::event);
Ok(())
}
fn reset_hold(&self, _type: ResetType) {