From ab575a54b94f239ff38d7f009b01f8c3954922b6 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Wed, 21 May 2025 13:02:40 +0200 Subject: [PATCH] misc: devices: streamline #[source] and Error impl This streamlines the Error implementation in the Cloud Hypervisor code base to match the remaining parts so that everything follows the agreed conventions. These are leftovers missed in the previous commits. Signed-off-by: Philipp Schuster On-behalf-of: SAP philipp.schuster@sap.com --- devices/src/interrupt_controller.rs | 8 ++++---- devices/src/legacy/gpio_pl061.rs | 6 +++--- devices/src/legacy/uart_pl011.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/devices/src/interrupt_controller.rs b/devices/src/interrupt_controller.rs index 957dcb876..5922b4de9 100644 --- a/devices/src/interrupt_controller.rs +++ b/devices/src/interrupt_controller.rs @@ -37,19 +37,19 @@ pub enum Error { #[cfg(target_arch = "aarch64")] /// Failed creating GIC device. #[error("Failed creating GIC device: {0}")] - CreateGic(hypervisor::HypervisorVmError), + CreateGic(#[source] hypervisor::HypervisorVmError), #[cfg(target_arch = "aarch64")] /// Failed restoring GIC device. #[error("Failed restoring GIC device: {0}")] - RestoreGic(hypervisor::arch::aarch64::gic::Error), + RestoreGic(#[source] hypervisor::arch::aarch64::gic::Error), #[cfg(target_arch = "riscv64")] /// Failed creating AIA device. #[error("Failed creating AIA device: {0}")] - CreateAia(hypervisor::HypervisorVmError), + CreateAia(#[source] hypervisor::HypervisorVmError), #[cfg(target_arch = "riscv64")] /// Failed restoring AIA device. #[error("Failed restoring AIA device: {0}")] - RestoreAia(hypervisor::arch::riscv64::aia::Error), + RestoreAia(#[source] hypervisor::arch::riscv64::aia::Error), } type Result = result::Result; diff --git a/devices/src/legacy/gpio_pl061.rs b/devices/src/legacy/gpio_pl061.rs index 9b2a351b9..66a5a5480 100644 --- a/devices/src/legacy/gpio_pl061.rs +++ b/devices/src/legacy/gpio_pl061.rs @@ -43,11 +43,11 @@ const N_GPIOS: u32 = 8; pub enum Error { #[error("Bad Write Offset: {0}")] BadWriteOffset(u64), - #[error("GPIO interrupt disabled by guest driver.")] + #[error("GPIO interrupt disabled by guest driver")] GpioInterruptDisabled, - #[error("Could not trigger GPIO interrupt: {0}.")] + #[error("Could not trigger GPIO interrupt: {0}")] GpioInterruptFailure(#[source] io::Error), - #[error("Invalid GPIO Input key triggered: {0}.")] + #[error("Invalid GPIO Input key triggered: {0}")] GpioTriggerKeyFailure(u32), } diff --git a/devices/src/legacy/uart_pl011.rs b/devices/src/legacy/uart_pl011.rs index 549d6b6a6..b1b2bbac9 100644 --- a/devices/src/legacy/uart_pl011.rs +++ b/devices/src/legacy/uart_pl011.rs @@ -51,7 +51,7 @@ const AMBA_ID_HIGH: u64 = 0x401; pub enum Error { #[error("pl011_write: Bad Write Offset: {0}")] BadWriteOffset(u64), - #[error("pl011: DMA not implemented.")] + #[error("pl011: DMA not implemented")] DmaNotImplemented, #[error("Failed to trigger interrupt: {0}")] InterruptFailure(#[source] io::Error),