iommu/vt-d: Adjsut the return value of the parse_ioapics_under_ir
PATCH v2 1/1 iommu/vt-d: Adjsut the return value of the parse_ioapics_under_ir
Adjust the return value of parse_ioapics_under_ir as negative value representing failure and "0" representing succcess. Just make it consistent with other function implementation, and we can judge if calling is successfull by if (!parse_ioapics_under_ir()) style.
---v1->v2:
Drop the patch 2/1 of v1 patchset since it's a wrong patch. Joerg suggested that replace "-1" with "-ENODEV" which is more specific.
drivers/iommu/intel_irq_remapping.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/intel_irq_remapping.c +3 -3
@@ -672,7 +672,7 @@ static int __init intel_prepare_irq_remapping(void)if (!dmar_ir_support ())return -ENODEV ; -if (parse_ioapics_under_ir () !=1 ) { +if (!parse_ioapics_under_ir ()) {pr_info ("Not enabling interrupt remapping\n" ); goto error; }
@@ -916,7 +916,7 @@ static int __init parse_ioapics_under_ir(void) }if (!ir_supported) -return 0 ; +return -ENODEV ;for (ioapic_idx =0 ; ioapic_idx < nr_ioapics; ioapic_idx++) {int ioapic_id =mpc_ioapic_id (ioapic_idx);
@@ -928,7 +928,7 @@ static int __init parse_ioapics_under_ir(void) } } -return 1 ; +return 0 ; }static int __init ir_dev_scope_init (void )
Signature · 1 line
2.1.0
Joerg Roedel
maintainerPATCH 1/1 iommu/vt-d: Propagate error-value from ir_parse_ioapic_hpet_scope()
Quoted 6 lines · Baoquan He
Adjust the return value of
parse_ioapics_under_iras negative value representing failure and "0" representing succcess. Just make it consistent with other function implementation, and we can judge if calling is successfull by if (!parse_ioapics_under_ir()) style.Signed-off-by Baoquan He <[email protected]>
Applied thanks. I also put below patch on-top to also propate the error value returned from ir_parse_ioapic_hpet_scope().
Quoted 1 line
From
66ef950d1841487c852d68d00977726f1cd9f053Mon Sep 17 00:00:00 2001
From: Joerg Roedel <[email protected]>
Date: Fri, 23 Oct 2015 11:57:13 +0200
Subject: [PATCH] iommu/vt-d: Propagate error-value from
ir_parse_ioapic_hpet_scope()
Propagate the error-value from the function ir_parse_ioapic_hpet_scope() in parse_ioapics_under_ir() and cleanup its calling loop.
--- drivers/iommu/intel_irq_remapping.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/iommu/intel_irq_remapping.c +11 -6
@@ -934,13 +934,18 @@ static int __init parse_ioapics_under_ir(void)bool ir_supported = false;int ioapic_idx; -for_each_iommu (iommu, drhd) -if (ecap_ir_support (iommu->ecap)) { -if (ir_parse_ioapic_hpet_scope (drhd->hdr, iommu)) -return -1 ; +for_each_iommu (iommu, drhd) { +int ret; - ir_supported = true; - } +if (!ecap_ir_support (iommu->ecap)) +continue ; + + ret =ir_parse_ioapic_hpet_scope (drhd->hdr, iommu); +if (ret) +return ret; + + ir_supported = true; + }if (!ir_supported)return -ENODEV ;
Signature · 1 line
1.8.4.5