From nobody Fri Nov 29 03:43:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1650383215; cv=none; d=zohomail.com; s=zohoarc; b=QHNR4sRpoHIPfoBlIr1NUMxkNd9xSLT7EVB4pwDgFCIlvu09fJFmkK3rRcrDHSR2Pm5ZAyArdolkt5R/uS5pIE2aRBjVkruhJZTbIMNWp3voNmaBjGJk33VH+RxJdAQxtT6b8DtC6VUzNdpLnoT2Cl6N8dhMlUlSOhUIwuibuwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650383215; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=6BG+RIksgbZTEj/9zUG9lgF5QU8jZwsywEaD/+BOtvM=; b=RpfBkfm+QhJlxAfN862jg9MgkAwYxLQB2f5O5dRwVLcIzkANwPDNusZkyAMF/H8vHI9uudv3egxa+c+6z+JwIgGmf4QTcu4lHiYJhbxQJAUr64vXpxexkrO8JyXE7OlvlkTEyEMLpI25DE5WIaRWYV49e2qrWhsxeAmviiRvmSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1650383215992561.8322422718627; Tue, 19 Apr 2022 08:46:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.308310.523992 (Exim 4.92) (envelope-from ) id 1ngq3f-0005Zl-Dg; Tue, 19 Apr 2022 15:46:27 +0000 Received: by outflank-mailman (output) from mailman id 308310.523992; Tue, 19 Apr 2022 15:46:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngq3f-0005Ze-Af; Tue, 19 Apr 2022 15:46:27 +0000 Received: by outflank-mailman (input) for mailman id 308310; Tue, 19 Apr 2022 15:46:25 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngq3d-0005ZY-7U for xen-devel@lists.xenproject.org; Tue, 19 Apr 2022 15:46:25 +0000 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [2607:f8b0:4864:20::52e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id dd35f2ab-bff7-11ec-8fbf-03012f2f19d4; Tue, 19 Apr 2022 17:46:24 +0200 (CEST) Received: by mail-pg1-x52e.google.com with SMTP id h5so24434302pgc.7 for ; Tue, 19 Apr 2022 08:46:24 -0700 (PDT) Received: from localhost ([118.33.58.98]) by smtp.gmail.com with ESMTPSA id d139-20020a621d91000000b00505aa0d10desm17001194pfd.0.2022.04.19.08.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 08:46:22 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: dd35f2ab-bff7-11ec-8fbf-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=6BG+RIksgbZTEj/9zUG9lgF5QU8jZwsywEaD/+BOtvM=; b=FzWAF9GgsnGSSbOr3x4q7dLveuqFq9PvQdzhBro+/ZYJJ5ro1rUdgNPd63IusHP1vj V3wj9BBNC4CDwBdkEORDcUsbwos06DjcGku8h2FoXdKNJUGOL0D8kFAQsGQ9qjE81/B3 iunuVO8HFB/X7IzDWM+ZHiGlnrjFdGyvDtZOKaCeTMRBzZbV0WuXyMyY7hf4QdXfnghy wdN1O06IGw/LY+I6mPmgpgCzf2hxM6eLRZhTv2G0n4aKOBUybX89Fw2Bd7dnM0GNqg22 bMp+IjC4mda6R9GSZvMGqAvJYgOR1QaOvbI01lBbUcrefYk4UDHxFHHKANpeUbvtlVVq D6Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=6BG+RIksgbZTEj/9zUG9lgF5QU8jZwsywEaD/+BOtvM=; b=Wbkki+9ONeoQ0ZgI0EKC/DX7i9LtSf/iUf+yockAp+gIqkptgQoyde489hzWCJ3zJ6 Uzg26XbYRG5YgS0jHr50hrs5P+Lb4surLGYBeALEsJs9Wd/oPDsffYYQnnabl+cK2+s1 GOfXAUb/4bnpJiDWpnsHGhWIT1gUuOxVOFzAzqpyB3xX20FrjdMlhzT5sTBtF4c2rUIG F4fPyvAb68wjQnxZp7JK/Pbqlh121t9JpXNuPz3v2ASiDRD8W7eJCHUrhYc53f/fxAdT kRiPhgFjO0A4bpOcBa1CrTeOkr4jgvhPR2ZmSw6UvxlDqozKzZqnBLGcFrvHbBSX4jtP 1l8g== X-Gm-Message-State: AOAM533tRBpl0KeAbeZBYWevWTaQ74xkeDf8lqOPUAkQ3xv3N06zUBVp b8Ej7lKYikgBfSEiy7RShyg= X-Google-Smtp-Source: ABdhPJzcbmbLOeCiojnBYy2e5lIdM8/t9skNUIJFGVWqAiWoyTyedrtKtdqxUIHVJXv1iXGShWDeVw== X-Received: by 2002:a62:5287:0:b0:505:651c:ffae with SMTP id g129-20020a625287000000b00505651cffaemr18171393pfb.13.1650383182481; Tue, 19 Apr 2022 08:46:22 -0700 (PDT) Date: Wed, 20 Apr 2022 00:46:19 +0900 From: Paran Lee To: Stefano Stabellini , Julien Grall Cc: austindh.kim@gmail.com, xen-devel@lists.xenproject.org Subject: [PATCH] xen/device_tree: silence ambiguous integer casting warning error Message-ID: <20220419154619.GA3136@DESKTOP-NK4TH6S.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1650383217029100001 GCC with "-g -Wall -Wextra" option throws warning message as below: error: comparison of integer expressions of different signedness: =E2=80=98int=E2=80=99 and =E2=80=98unsigned int=E2=80=99 [-Werror=3Dsign-c= ompare] Silence the warning by correcting the integer type. Signed-off-by: Paran Lee --- xen/common/device_tree.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 4aae281e89..402e465c7a 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -79,7 +79,7 @@ struct dt_bus const char *addresses; bool_t (*match)(const struct dt_device_node *node); void (*count_cells)(const struct dt_device_node *child, - int *addrc, int *sizec); + unsigned int *addrc, unsigned int *sizec); u64 (*map)(__be32 *addr, const __be32 *range, int na, int ns, int pna); int (*translate)(__be32 *addr, u64 offset, int na); unsigned int (*get_flags)(const __be32 *addr); @@ -569,7 +569,7 @@ static bool_t dt_bus_default_match(const struct dt_devi= ce_node *node) } =20 static void dt_bus_default_count_cells(const struct dt_device_node *dev, - int *addrc, int *sizec) + unsigned int *addrc, unsigned int *= sizec) { if ( addrc ) *addrc =3D dt_n_addr_cells(dev); @@ -649,7 +649,7 @@ static bool_t dt_bus_pci_match(const struct dt_device_n= ode *np) } =20 static void dt_bus_pci_count_cells(const struct dt_device_node *np, - int *addrc, int *sizec) + unsigned int *addrc, unsigned int *sizec) { if (addrc) *addrc =3D 3; @@ -737,7 +737,7 @@ static const struct dt_bus dt_busses[] =3D =20 static const struct dt_bus *dt_match_bus(const struct dt_device_node *np) { - int i; + long unsigned int i; =20 for ( i =3D 0; i < ARRAY_SIZE(dt_busses); i++ ) if ( !dt_busses[i].match || dt_busses[i].match(np) ) @@ -754,7 +754,8 @@ static const __be32 *dt_get_address(const struct dt_dev= ice_node *dev, u32 psize; const struct dt_device_node *parent; const struct dt_bus *bus; - int onesize, i, na, ns; + unsigned int i; + unsigned int onesize, na, ns; =20 /* Get parent & match bus type */ parent =3D dt_get_parent(dev); @@ -797,8 +798,7 @@ static int dt_translate_one(const struct dt_device_node= *parent, int pna, const char *rprop) { const __be32 *ranges; - unsigned int rlen; - int rone; + unsigned int rlen, rone; u64 offset =3D DT_BAD_ADDR; =20 ranges =3D dt_get_property(parent, rprop, &rlen); @@ -857,7 +857,7 @@ static u64 __dt_translate_address(const struct dt_devic= e_node *dev, const struct dt_device_node *parent =3D NULL; const struct dt_bus *bus, *pbus; __be32 addr[DT_MAX_ADDR_CELLS]; - int na, ns, pna, pns; + unsigned int na, ns, pna, pns; u64 result =3D DT_BAD_ADDR; =20 dt_dprintk("DT: ** translation for device %s **\n", dev->full_name); @@ -966,8 +966,7 @@ int dt_for_each_range(const struct dt_device_node *dev, const struct dt_bus *bus, *pbus; const __be32 *ranges; __be32 addr[DT_MAX_ADDR_CELLS]; - unsigned int rlen; - int na, ns, pna, pns, rone; + unsigned int rlen, na, ns, pna, pns, rone; =20 bus =3D dt_match_bus(dev); if ( !bus ) @@ -1134,7 +1133,7 @@ unsigned int dt_number_of_address(const struct dt_dev= ice_node *dev) u32 psize; const struct dt_device_node *parent; const struct dt_bus *bus; - int onesize, na, ns; + unsigned int onesize, na, ns; =20 /* Get parent & match bus type */ parent =3D dt_get_parent(dev); @@ -1169,8 +1168,8 @@ int dt_for_each_irq_map(const struct dt_device_node *= dev, const struct dt_device_node *ipar, *tnode, *old =3D NULL; const __be32 *tmp, *imap; u32 intsize =3D 1, addrsize, pintsize =3D 0, paddrsize =3D 0; - u32 imaplen; - int i, ret; + u32 i, imaplen; + int ret; =20 struct dt_raw_irq dt_raw_irq; struct dt_irq dt_irq; @@ -1354,8 +1353,8 @@ static int dt_irq_map_raw(const struct dt_device_node= *parent, const struct dt_device_node *ipar, *tnode, *old =3D NULL, *newpar =3D = NULL; const __be32 *tmp, *imap, *imask; u32 intsize =3D 1, addrsize, newintsize =3D 0, newaddrsize =3D 0; - u32 imaplen; - int match, i; + u32 i, imaplen; + int match; =20 dt_dprintk("dt_irq_map_raw: par=3D%s,intspec=3D[0x%08x 0x%08x...],oint= size=3D%d\n", parent->full_name, be32_to_cpup(intspec), @@ -1737,7 +1736,7 @@ static int __dt_parse_phandle_with_args(const struct = dt_device_node *np, =20 if ( out_args ) { - int i; + u32 i; =20 WARN_ON(count > MAX_PHANDLE_ARGS); if (count > MAX_PHANDLE_ARGS) --=20 2.25.1