[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/arm: pci: fix -Wtype-limits warning in pci-host-common.c
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Wed, 3 May 2023 15:18:20 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nJnGX5ULMa6JNgalgwK8aS04dIdQBzShnRt2jL2i2WM=; b=dBGkZW3uDEYItZiwXENNMuP29NYyArq044dWcsaIBOk30Gcyyq6Sm8hgJe+igvXrI5syczxZW6bmbpJ48qEE5MJK9K48RvjCJHWm07Nn42X9y+XkyPvjpAaWHlGLmgM+P4zmqZJkD+zAuH51eFrZ5KRG8OWtvwWAEco35P5SOCmD4/AjPCOkpY+XaIMRfVjckhHlJ3kUuxoUNak7PrQk7Z+K6wc9wYlQaLca6nidah77CngF6Euy6rteU41NoXI/1GCgqMeqxX6YxiXWM56Dd3+tsTFLxTv5gpjIfuUmUx14bIb4Tejy+Y/hyLbNz3qoy1LVyEATLC1/7ozHZ1JSPQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=awTPgLlZQFHMVZe1jqiHifPCm8RPkQCeWRvL5+7vFylfx/Qc4fHKrVoYF4MT7t902wAO/JZ8nCAQJFDiZ5PuRlA0tIJ1aFslSWdI46ZYUjfW74J2iVSXooFf0sckF3x2LkpUod/o1cgN4cExgGEtQ1XNjev1Te88h9yAvm7jM9kDBsjwNXva+RPSUii3Vq46VUhKWIVvjcP3h5fH3jWpQ4nsHzMFuwlTsZqkFmea2lfQlquGNwaZ6ZUMb0IJcdi7wrKvlFA75knPMusqAGTGvSFomprvILqORQD62VNGT/ZTeMl5qPT9pASJ1vJG/Eo/euGT6igFJCJn+eSAIJeeZQ==
- Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Wed, 03 May 2023 19:18:48 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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.
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@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 a8ece94303ca..7474d877deb8 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;
--
2.40.1
|