[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] iommu/arm: smmu: Fix variable shadowing



On Tue, 7 Apr 2026, Michal Orzel wrote:
> Rename 'pdev' to 'pci_dev' in the dev_print_pci() macro to avoid
> shadowing local 'pdev' variables at call sites.
> 
> Remove the unused 'ret' declaration from arm_smmu_dt_add_device_generic()
> where the function-scope 'ret' is sufficient.
> 
> Fix shadowing of 'domain' in arm_smmu_assign_dev() by removing the
> inner-scope redeclaration, using the function-scope variable instead.
> 
> This fixes MISRA C R5.3.
> 
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
>  xen/drivers/passthrough/arm/smmu.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu.c 
> b/xen/drivers/passthrough/arm/smmu.c
> index 22d306d0cb80..d63c9015510e 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -130,8 +130,8 @@ typedef enum irqreturn irqreturn_t;
>          printk(lvl "smmu: %s: " fmt, dev_name((dev)), ## __VA_ARGS__);  \
>      else                                                                \
>      {                                                                   \
> -        struct pci_dev *pdev = dev_to_pci((dev));                       \
> -        printk(lvl "smmu: %pp: " fmt, &pdev->sbdf, ## __VA_ARGS__);     \
> +        struct pci_dev *pci_dev = dev_to_pci((dev));                    \
> +        printk(lvl "smmu: %pp: " fmt, &pci_dev->sbdf, ## __VA_ARGS__);  \
>      }                                                                   \
>  })
>  #endif
> @@ -927,7 +927,6 @@ static int arm_smmu_dt_add_device_generic(u8 devfn, 
> struct device *dev)
>       if ( dev_is_pci(dev) )
>       {
>               struct pci_dev *pdev = dev_to_pci(dev);
> -             int ret;
>  
>               /* Ignore calls for phantom functions */
>               if ( devfn != pdev->devfn )
> @@ -2788,7 +2787,7 @@ static int arm_smmu_assign_dev(struct domain *d, u8 
> devfn,
>               /* dom_io is used as a sentinel for quarantined devices */
>               if ( d == dom_io )
>               {
> -                     struct iommu_domain *domain = dev_iommu_domain(dev);
> +                     domain = dev_iommu_domain(dev);
>                       if ( !iommu_quarantine )
>                               return 0;
>  
> -- 
> 2.43.0
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.