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

[xen master] iommu/arm: smmu: Fix variable shadowing



commit ecd7038deb309a746042960ad93748e7787a1327
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Tue Apr 7 12:34:32 2026 +0200
Commit:     Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Wed Apr 8 08:12:27 2026 +0200

    iommu/arm: smmu: Fix variable shadowing
    
    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 22d306d0cb..d63c901551 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;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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