From: Julien Grall Subject: [v3 09/13] xen/arm: gic: Allow the base address to be 0 Date: Wed, 1 Jul 2015 12:01:09 +0100 Message-ID: <1435748473-28812-11-git-send-email-julien.grall@citrix.com> References: <1435748473-28812-1-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZAFz7-0002rc-NT for xen-devel@lists.xenproject.org; Wed, 01 Jul 2015 11:15:21 +0000 In-Reply-To: <1435748473-28812-1-git-send-email-julien.grall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Julien Grall , Zoltan Kiss , stefano.stabellini@citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org 0 is a valid physical address and dt_device_get_address would return an error if a problem during the retrieving happen. Signed-off-by: Julien Grall Acked-by: Ian Campbell Cc: Zoltan Kiss --- Changes in v2: - Add Ian's ack - Merge "xen/arm: gic-v2: Allow the base address to be 0" and "xen/arm: gic-hip04: Allow the base address to be 0" in a single patch. - Remove the check in gicv3 too --- xen/arch/arm/gic-hip04.c | 8 ++++---- xen/arch/arm/gic-v2.c | 8 ++++---- xen/arch/arm/gic-v3.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/gic-hip04.c b/xen/arch/arm/gic-hip04.c index 0ba15d1..1b9d35e 100644 --- a/xen/arch/arm/gic-hip04.c +++ b/xen/arch/arm/gic-hip04.c @@ -680,19 +680,19 @@ static int __init hip04gic_init(void) const struct dt_device_node *node = gicv2_info.node; res = dt_device_get_address(node, 0, &gicv2.dbase, NULL); - if ( res || !gicv2.dbase ) + if ( res ) panic("GIC-HIP04: Cannot find a valid address for the distributor"); res = dt_device_get_address(node, 1, &gicv2.cbase, NULL); - if ( res || !gicv2.cbase ) + if ( res ) panic("GIC-HIP04: Cannot find a valid address for the CPU"); res = dt_device_get_address(node, 2, &gicv2.hbase, NULL); - if ( res || !gicv2.hbase ) + if ( res ) panic("GIC-HIP04: Cannot find a valid address for the hypervisor"); res = dt_device_get_address(node, 3, &gicv2.vbase, NULL); - if ( res || !gicv2.vbase ) + if ( res ) panic("GIC-HIP04: Cannot find a valid address for the virtual CPU"); res = platform_get_irq(node, 0); diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index f49ecd8..5d0eb83 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -666,19 +666,19 @@ static int __init gicv2_init(void) const struct dt_device_node *node = gicv2_info.node; res = dt_device_get_address(node, 0, &gicv2.dbase, NULL); - if ( res || !gicv2.dbase ) + if ( res ) panic("GICv2: Cannot find a valid address for the distributor"); res = dt_device_get_address(node, 1, &gicv2.cbase, NULL); - if ( res || !gicv2.cbase ) + if ( res ) panic("GICv2: Cannot find a valid address for the CPU"); res = dt_device_get_address(node, 2, &gicv2.hbase, NULL); - if ( res || !gicv2.hbase ) + if ( res ) panic("GICv2: Cannot find a valid address for the hypervisor"); res = dt_device_get_address(node, 3, &gicv2.vbase, NULL); - if ( res || !gicv2.vbase ) + if ( res ) panic("GICv2: Cannot find a valid address for the virtual CPU"); res = platform_get_irq(node, 0); diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 90cfa73..1c38c02 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1198,7 +1198,7 @@ static int __init gicv3_init(void) } res = dt_device_get_address(node, 0, &gicv3.dbase, NULL); - if ( res || !gicv3.dbase ) + if ( res ) panic("GICv3: Cannot find a valid distributor address"); if ( (gicv3.dbase & ~PAGE_MASK) ) @@ -1230,7 +1230,7 @@ static int __init gicv3_init(void) uint64_t rdist_base, rdist_size; res = dt_device_get_address(node, 1 + i, &rdist_base, &rdist_size); - if ( res || !rdist_base ) + if ( res ) panic("GICv3: No rdist base found for region %d\n", i); rdist_regs[i].base = rdist_base; -- 2.1.4