diff options
| author | Danilo Krummrich <dakr@kernel.org> | 2025-09-26 15:05:53 +0200 |
|---|---|---|
| committer | Alexandre Courbot <acourbot@nvidia.com> | 2025-10-16 08:04:46 +0900 |
| commit | f7a33a67c50c92589b046e69b9075b7d28d31f87 (patch) | |
| tree | cdab4c30ee5ac5f12fe8f16bb248d6ce6eb12048 /drivers/gpu/nova-core/firmware | |
| parent | 87990025b87283f1b8c50d4d75379ca6d86d2211 (diff) | |
gpu: nova-core: gsp: do not unwrap() SGEntry
Don't use unwrap() to extract an Option<SGEntry>, instead handle the
error condition gracefully.
Fixes: a841614e607c ("gpu: nova-core: firmware: process and prepare the GSP firmware")
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Message-ID: <20250926130623.61316-2-dakr@kernel.org>
Diffstat (limited to 'drivers/gpu/nova-core/firmware')
| -rw-r--r-- | drivers/gpu/nova-core/firmware/gsp.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs index ca785860e1c8..6b0761460a57 100644 --- a/drivers/gpu/nova-core/firmware/gsp.rs +++ b/drivers/gpu/nova-core/firmware/gsp.rs @@ -202,9 +202,10 @@ impl GspFirmware { let mut level0_data = kvec![0u8; GSP_PAGE_SIZE]?; // Fill level 1 page entry. - let level1_entry = level1.iter().next().unwrap().dma_address(); - let dst = &mut level0_data[..size_of_val(&level1_entry)]; - dst.copy_from_slice(&level1_entry.to_le_bytes()); + let level1_entry = level1.iter().next().ok_or(EINVAL)?; + let level1_entry_addr = level1_entry.dma_address(); + let dst = &mut level0_data[..size_of_val(&level1_entry_addr)]; + dst.copy_from_slice(&level1_entry_addr.to_le_bytes()); // Turn the level0 page table into a [`DmaObject`]. DmaObject::from_data(dev, &level0_data)? |
