mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
virtio-devices: pmem: Avoid panic and propagate errors properly
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
4cc3bdba9f
commit
522e32219c
@ -90,6 +90,8 @@ enum Error {
|
||||
BufferLengthTooSmall,
|
||||
#[error("Invalid request")]
|
||||
InvalidRequest,
|
||||
#[error("Failed adding used index: {0}")]
|
||||
QueueAddUsed(virtio_queue::Error),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
@ -197,7 +199,7 @@ impl PmemEpollHandler {
|
||||
|
||||
self.queue
|
||||
.add_used(desc_chain.memory(), desc_chain.head_index(), len)
|
||||
.unwrap();
|
||||
.map_err(Error::QueueAddUsed)?;
|
||||
used_descs = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user