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

[xen master] xen/arm: pci: fix -Wtype-limits warning in pci-host-common.c



commit cb781ae2c98de5d5742aa0de6850f371fb25825f
Author:     Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
AuthorDate: Wed May 3 15:18:20 2023 -0400
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Thu May 11 12:57:36 2023 +0100

    xen/arm: pci: fix -Wtype-limits warning in pci-host-common.c
    
    When building with EXTRA_CFLAGS_XEN_CORE="-Wtype-limits", we observe the
    following warning:
    
    arch/arm/pci/pci-host-common.c: In function â??pci_host_common_probeâ??:
    arch/arm/pci/pci-host-common.c:238:26: warning: comparison is always false 
due to limited range of data type [-Wtype-limits]
      238 |     if ( bridge->segment < 0 )
          |                          ^
    
    This is due to bridge->segment being an unsigned type. Fix it by 
introducing a
    new variable of signed type to use in the condition.
    
    Fixes: 6ec9176d94ae ("xen/arm: PCI host bridge discovery within XEN on ARM")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
    Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx<mailto:rahul.singh@xxxxxxx>>
---
 xen/arch/arm/pci/pci-host-common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/pci/pci-host-common.c 
b/xen/arch/arm/pci/pci-host-common.c
index a8ece94303..7474d877de 100644
--- a/xen/arch/arm/pci/pci-host-common.c
+++ b/xen/arch/arm/pci/pci-host-common.c
@@ -214,6 +214,7 @@ int pci_host_common_probe(struct dt_device_node *dev,
     struct pci_host_bridge *bridge;
     struct pci_config_window *cfg;
     int err;
+    int domain;
 
     if ( dt_device_for_passthrough(dev) )
         return 0;
@@ -234,12 +235,13 @@ int pci_host_common_probe(struct dt_device_node *dev,
     bridge->cfg = cfg;
     bridge->ops = &ops->pci_ops;
 
-    bridge->segment = pci_bus_find_domain_nr(dev);
-    if ( bridge->segment < 0 )
+    domain = pci_bus_find_domain_nr(dev);
+    if ( domain < 0 )
     {
         printk(XENLOG_ERR "Inconsistent \"linux,pci-domain\" property in 
DT\n");
         BUG();
     }
+    bridge->segment = domain;
     pci_add_host_bridge(bridge);
 
     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®.