Skip to content

Commit e26262c

Browse files
committed
fixup! soc: apple: Add support for the PMP co-processor
Use kvec! to construct zero initialized KVec. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent fc0a309 commit e26262c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/soc/apple/pmp.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use kernel::{
2020
dma::CoherentAllocation,
2121
io::mem::IoMem,
2222
iosys_map::IoSysMapRef,
23+
kvec,
2324
module_platform_driver,
2425
new_mutex,
2526
of,
@@ -150,10 +151,7 @@ impl PmpData {
150151
fn patch_bootargs(&self, patches: &[(u32, u32)]) -> Result<()> {
151152
let offset = self.pmp_read32(BOOTARGS_OFFSET) as usize;
152153
let size = self.pmp_read32(BOOTARGS_SIZE) as usize;
153-
let mut arg_bytes = KVec::with_capacity(size, GFP_KERNEL)?;
154-
for _ in 0..size {
155-
arg_bytes.push(0, GFP_KERNEL).unwrap();
156-
}
154+
let mut arg_bytes = kvec![0u8; size]?;
157155
{
158156
let pmp_mmio = self.pmp_mmio.try_access().ok_or(ENXIO)?;
159157
pmp_mmio.try_memcpy_fromio(&mut arg_bytes, offset)?;

0 commit comments

Comments
 (0)