Skip to content

Commit 0782e6c

Browse files
committed
Fix examples.
1 parent ec5aec5 commit 0782e6c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/aarch64/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ use virtio_drivers::{
4646
},
4747
DeviceType, Transport,
4848
},
49+
UniqueMmioPointer,
4950
};
5051

5152
/// Base memory-mapped address of the primary PL011 UART device.
@@ -142,7 +143,9 @@ fn main(x0: u64, x1: u64, x2: u64, x3: u64) -> ! {
142143
debug!("Found VirtIO MMIO device at {:?}", region);
143144

144145
let header = NonNull::new(region.starting_address as *mut VirtIOHeader).unwrap();
145-
match unsafe { MmioTransport::new(header, region.size.unwrap()) } {
146+
match unsafe {
147+
MmioTransport::new(UniqueMmioPointer::new(header), region.size.unwrap())
148+
} {
146149
Err(e) => warn!("Error creating VirtIO MMIO transport: {}", e),
147150
Ok(transport) => {
148151
info!(

examples/riscv/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use virtio_drivers::{
2323
mmio::{MmioTransport, VirtIOHeader},
2424
DeviceType, Transport,
2525
},
26+
UniqueMmioPointer,
2627
};
2728
use virtio_impl::HalImpl;
2829

@@ -69,7 +70,7 @@ fn virtio_probe(node: FdtNode) {
6970
node.compatible().map(Compatible::first),
7071
);
7172
let header = NonNull::new(vaddr as *mut VirtIOHeader).unwrap();
72-
match unsafe { MmioTransport::new(header, size) } {
73+
match unsafe { MmioTransport::new(UniqueMmioPointer::new(header), size) } {
7374
Err(e) => warn!("Error creating VirtIO MMIO transport: {}", e),
7475
Ok(transport) => {
7576
info!(

0 commit comments

Comments
 (0)