mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
gpu: nova-core: gsp: use KVVec::zeroed() for payload buffers
Use KVVec::zeroed() instead of KVVec::from_elem() to allocate and zero-initialize the command and continuation payload buffers. Also use KVVec::zeroed() in the test helper read_payload(). Signed-off-by: Thorsten Blum <blum@kernel.org> Link: https://patch.msgid.link/20261006115311.92873-3-blum@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
parent
e56059016a
commit
6148fb2fc4
|
|
@ -106,9 +106,9 @@ pub(super) fn new(command: C) -> Result<Self> {
|
|||
|
||||
if command.size() > MAX_CMD_SIZE {
|
||||
let mut command_payload =
|
||||
KVVec::<u8>::from_elem(0u8, payload_len.min(Self::MAX_FIRST_PAYLOAD), GFP_KERNEL)?;
|
||||
KVVec::zeroed(payload_len.min(Self::MAX_FIRST_PAYLOAD), GFP_KERNEL)?;
|
||||
let mut continuation_payload =
|
||||
KVVec::<u8>::from_elem(0u8, payload_len - command_payload.len(), GFP_KERNEL)?;
|
||||
KVVec::zeroed(payload_len - command_payload.len(), GFP_KERNEL)?;
|
||||
let mut sbuffer = SBufferIter::new_writer([
|
||||
command_payload.as_mut_slice(),
|
||||
continuation_payload.as_mut_slice(),
|
||||
|
|
@ -235,7 +235,7 @@ fn init_variable_payload(
|
|||
|
||||
fn read_payload(cmd: impl CommandToGsp) -> Result<KVVec<u8>> {
|
||||
let len = cmd.variable_payload_len();
|
||||
let mut buf = KVVec::from_elem(0u8, len, GFP_KERNEL)?;
|
||||
let mut buf = KVVec::zeroed(len, GFP_KERNEL)?;
|
||||
let mut sbuf = SBufferIter::new_writer([buf.as_mut_slice(), &mut []]);
|
||||
cmd.init_variable_payload(&mut sbuf)?;
|
||||
drop(sbuf);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user