Skip to contentSkip to conversation

xen/arm: domain_build: Propagate return code of map_irq_to_domain()

PATCH Superseded Michal Orzel 2 participants 3 messages May 11, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: domain_build: Propagate return code of map_irq_to_domain()

From map_dt_irq_to_domain() we are assigning a return code of map_irq_to_domain() to a variable without checking it for an error. Fix it by propagating the return code directly since this is the last call.

Take the opportunity to use the correct printk() format specifiers, since both irq and domain id are of unsigned types.

Fixes 467e5cbb2ffc ("xen: arm: consolidate mmio and irq mapping to dom0")
---
 xen/arch/arm/domain_build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/domain_build.c +3 -3
index f80fdd1af206..2c14718bff87 100644
@@ -2303,7 +2303,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
     if ( irq < NR_LOCAL_IRQS )
     {
-        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
+        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n",
                dt_node_name(dev), irq);
         return -EINVAL;
     }
@@ -2313,14 +2313,14 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
     if ( res )
     {
         printk(XENLOG_ERR
-               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
+               "%s: Unable to setup IRQ%u to dom%u\n",
                dt_node_name(dev), irq, d->domain_id);
         return res;
     }
 
     res = map_irq_to_domain(d, irq, !mr_data->skip_mapping, dt_node_name(dev));
 
-    return 0;
+    return res;
 }
 
 int __init map_range_to_domain(const struct dt_device_node *dev,
Signature · 1 line
2.25.1
#1 lore raw

Hi Michal,

Quoted 7 lines · Michal Orzel

From map_dt_irq_to_domain() we are assigning a return code of
map_irq_to_domain() to a variable without checking it for an error. Fix it by propagating the return code directly since this is the last call.

Take the opportunity to use the correct printk() format specifiers, since both irq and domain id are of unsigned types.

I would rather prefer if this is split in a separate patch because while we want to backport the first part, I don't think the latter wants to be.

Quoted 21 lines
Fixes 467e5cbb2ffc ("xen: arm: consolidate mmio and irq mapping to dom0")
---
  xen/arch/arm/domain_build.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/domain_build.c +1 -1
index f80fdd1af206..2c14718bff87 100644
@@ -2303,7 +2303,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
      if ( irq < NR_LOCAL_IRQS )
      {
-        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
+        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n",
                 dt_node_name(dev), irq);
          return -EINVAL;
      }

xen/arch/arm/domain_build.c static int __init map_dt_irq_to_domain(const struct dt_device_node *dev, · line 2317

Quoted 6 lines
xen/arch/arm/domain_build.c +1 -1
@@ -2313,14 +2313,14 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
      if ( res )
      {
          printk(XENLOG_ERR
-               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
+               "%s: Unable to setup IRQ%u to dom%u\n",
                 dt_node_name(dev), irq, d->domain_id);

Please switch %pd when printing the domain.

xen/arch/arm/domain_build.c static int __init map_dt_irq_to_domain(const struct dt_device_node *dev, · line 2326

Quoted 10 lines
xen/arch/arm/domain_build.c +1 -1
          return res;
      }
 
      res = map_irq_to_domain(d, irq, !mr_data->skip_mapping, dt_node_name(dev));
 
-    return 0;
+    return res;
  }
 
  int __init map_range_to_domain(const struct dt_device_node *dev,

Cheers,

Signature · 1 line
Julien Grall
#2 lore raw

Hi Julien,

Quoted 10 lines · Julien Grall

Hi Michal,

Quoted 5 lines · Michal Orzel

From map_dt_irq_to_domain() we are assigning a return code of
map_irq_to_domain() to a variable without checking it for an error. Fix it by propagating the return code directly since this is the last call.

Quoted 5 lines
Quoted 2 lines

Take the opportunity to use the correct printk() format specifiers, since both irq and domain id are of unsigned types.

I would rather prefer if this is split in a separate patch because while we want to backport the first part, I don't think the latter wants to be.

Sure. I will then fix specifiers in both map_dt_irq_to_domain and map_irq_to_domain.

Quoted 14 lines
Quoted 14 lines
Fixes 467e5cbb2ffc ("xen: arm: consolidate mmio and irq mapping to dom0")
---
  xen/arch/arm/domain_build.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/domain_build.c +0 -0
index f80fdd1af206..2c14718bff87 100644
@@ -2303,7 +2303,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
Quoted 16 lines
Quoted 8 lines
xen/arch/arm/domain_build.c +1 -1
      if ( irq < NR_LOCAL_IRQS )
      {
-        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
+        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n",
                 dt_node_name(dev), irq);
          return -EINVAL;
      }

xen/arch/arm/domain_build.c static int __init map_dt_irq_to_domain(const struct dt_device_node *dev, · line 2317

Quoted 6 lines
xen/arch/arm/domain_build.c +1 -1
@@ -2313,14 +2313,14 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
      if ( res )
      {
          printk(XENLOG_ERR
-               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
+               "%s: Unable to setup IRQ%u to dom%u\n",
                 dt_node_name(dev), irq, d->domain_id);

Please switch %pd when printing the domain.

ok

~Michal