Skip to contentSkip to conversation

gpu: nova-core: fsp: use KVec::zeroed() in recv_msg()

PATCH Applied Thorsten Blum 2 participants 2 messages Oct 6

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu: nova-core: fsp: use KVec::zeroed() in recv_msg()

Use KVec::zeroed() to create the message buffer in recv_msg() instead of creating an empty vector and resizing it.

---
 drivers/gpu/nova-core/falcon/fsp.rs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/nova-core/falcon/fsp.rs +1 -3
index 0437180b8829..4190f4f8e8c9 100644
@@ -172,9 +172,7 @@ pub(crate) fn recv_msg(&mut self) -> Result<KVec<u8>> {
             return Err(EMSGSIZE);
         }
 
-        let mut buffer = KVec::<u8>::new();
-        buffer.resize(msg_size, 0, GFP_KERNEL)?;
-
+        let mut buffer = KVec::<u8>::zeroed(msg_size, GFP_KERNEL)?;
         self.read_emem(&mut buffer)?;
 
         // Reset message queue pointers after reading.
maintainer Applied
#1 lore raw
Quoted 1 line · Thorsten Blum

[PATCH] gpu: nova-core: fsp: use KVec::zeroed() in recv_msg()

Applied, thanks!

Branch: drm-rust-next
Tree: https://gitlab.freedesktop.org/drm/rust/kernel.git

[1/1] gpu: nova-core: fsp: use KVec::zeroed() in recv_msg()
commit: 3e3404c52370

[ Avoid the unnecessary turbofish syntax. - Danilo ]

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is queued up for the upcoming merge window for the next major kernel release.