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

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


  • To: Stewart Hildebrand <Stewart.Hildebrand@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 4 May 2023 08:59:44 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=Pe4iGj8pxSowClsFdNt0rI/Ih7O9o6ufQz/RjTFFtZY=; b=B8ueVsysN5bjB2BbbX4UxWBO/eoLEW3pxKR+ElVbPOmBBPeCs/8rdnC6L6/LGtNt6R2EjVpAEXID6XJuW0kAvzlVflykJOFY++oJM6t1/QLoDWWdLrJY8aqUb7a5HPpBH09jwvW4Zm5EsDOE3vCBDun1FVkhvXK+AyItXyIfeeGL2CqZsVImOyFo9TFKEpXyyN/zs68R5nIINbZUR3ACI40qDbGBXO/wzbe71voyItZar2VAXyozWLFwsC+b5MZPpXcflpT819tjUkJej5nnSmN77zCDoYJahJJmmsPaBzpbJ8vP97HlTJwz9Qv3MebDxRFORnv/z1ErAGn41/al4g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VFUYSGY6Fi7KpZ1EpOD78bU4SjdODDDGXYYJf9cHx9cP/11HeJrrH5njMMxkH3jA5uYDXXx2V3Nw1bixeMRwZgFadbcixg/QI1BzXOyHn0xHi5EgPICgJ5JTo8e6ChJ/IcIpYsK4qmwYeQOrc9v6SDqNhmI/IzpFC8SEGycMVjF3S21oWov0tJfEBOpHn65Fj5j26R2d30aYGOdIn+M5hIVenKClmMN+qKyzpVOipU412xtTN/gQuy2Bjt/EVfcPwFb7a8dPNJXDdxUZPq2mWbio48CleGGAfPxij2T9vVjnaSkjrcZg/VmYyPiQ9rNPxS3HHciQ0W6JmnR6S+QYHg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 04 May 2023 09:00:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZffQTsmRRBKh80kOBQgH8fU6H2a9J0ZUA
  • Thread-topic: [PATCH] xen/arm: pci: fix -Wtype-limits warning in pci-host-common.c

Hi Stewart,

> On 3 May 2023, at 21:18, Stewart Hildebrand <Stewart.Hildebrand@xxxxxxx> 
> wrote:
> 
> 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>

I would see this as a bug fix more than a compiler warning fix as the error 
code was
ignored before that.

Anyway:
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand


> ---
> 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
> 


 


Rackspace

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