Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] The refactoring to use a local `Device` reference misses several 
`dev_dbg!` macro invocations in `Gpu::new`, leaving the task incomplete and the 
code inconsistent.
--

commit 5b411de251c3e77848e5e58356562796a1fb83fe
Author: Alexandre Courbot <[email protected]>

gpu: nova-core: avoid repeated calls to pci::Device::as_ref

Add a local Device reference created from the pci::Device in the
Gpu constructor to avoid repeatedly calling as_ref.

> diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
> index c04706b60ba80..663e61d0c023b 100644
> --- a/drivers/gpu/nova-core/gpu.rs
> +++ b/drivers/gpu/nova-core/gpu.rs

[ ... ]

> @@ -372,8 +374,8 @@ pub(crate) fn new(
>                  // Obtain and display basic GPU information.
>                  let info = gsp_resources.gsp.get_static_info(bar)?;
>                  match info.gpu_name() {
> -                    Ok(name) => dev_info!(pdev, "GPU name: {}\n", name),
> -                    Err(e) => dev_warn!(pdev, "GPU name unavailable: 
> {:?}\n", e),
> +                    Ok(name) => dev_info!(dev, "GPU name: {}\n", name),
> +                    Err(e) => dev_warn!(dev, "GPU name unavailable: {:?}\n", 
> e),
>                  }
>  
>                  if !info.usable_fb_regions.is_empty() {
>                      dev_dbg!(pdev, "Usable FB regions:\n");
>                      for region in &info.usable_fb_regions {
>                          dev_dbg!(pdev, "  - {:#x?}\n", region);
>                      }
>  
>                      dev_dbg!(
>                          pdev,
>                          "Total usable VRAM: {} MiB\n",
>                          info.usable_fb_regions.iter().fold(0u64, |res, 
> region| res
>                              .saturating_add(region.end - region.start))
>                              / u64::SZ_1M
>                      );

[Severity: Low]
This isn't a bug, but should these remaining dev_dbg!() macros also be updated
to use dev instead of pdev? Leaving them as pdev continues to implicitly
invoke .as_ref(), which this patch is trying to avoid.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=10

Reply via email to