Alexandre Courbot
2025-Oct-28 23:12 UTC
[PATCH v3 2/6] gpu: nova-core: vbios: do not use `as` when comparing BiosImageType
Use the `image_type` method and compare its result to avoid using `as`.
Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
---
drivers/gpu/nova-core/vbios.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index 74ed6d61e6cc..7c1bf10b2eac 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -709,9 +709,8 @@ fn image_type(&self) -> Result<BiosImageType> {
/// Check if this is the last image.
fn is_last(&self) -> bool {
- // For NBSI images (type == 0x70), return true as they're
- // considered the last image
- if self.pcir.code_type == BiosImageType::Nbsi as u8 {
+ // For NBSI images, return true as they're considered the last
image
+ if self.image_type() == Ok(BiosImageType::Nbsi) {
return true;
}
--
2.51.0
Joel Fernandes
2025-Nov-03 20:31 UTC
[PATCH v3 2/6] gpu: nova-core: vbios: do not use `as` when comparing BiosImageType
On Wed, Oct 29, 2025 at 08:12:10AM +0900, Alexandre Courbot wrote:> Use the `image_type` method and compare its result to avoid using `as`. > > Signed-off-by: Alexandre Courbot <acourbot at nvidia.com> > --- > drivers/gpu/nova-core/vbios.rs | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs > index 74ed6d61e6cc..7c1bf10b2eac 100644 > --- a/drivers/gpu/nova-core/vbios.rs > +++ b/drivers/gpu/nova-core/vbios.rs > @@ -709,9 +709,8 @@ fn image_type(&self) -> Result<BiosImageType> { > > /// Check if this is the last image. > fn is_last(&self) -> bool { > - // For NBSI images (type == 0x70), return true as they're > - // considered the last image > - if self.pcir.code_type == BiosImageType::Nbsi as u8 { > + // For NBSI images, return true as they're considered the last image > + if self.image_type() == Ok(BiosImageType::Nbsi) {nit: Could you add period at the end of the comment sentence as Miguel suggested in the other thread (which I admit the initial code also didn't have)? With that change, Reviewed-by: Joel Fernandes <joelagnelf at nvidia.com> thanks, - Joel> return true; > } > > > -- > 2.51.0 >