xen/drivers/passthrough/amd/iommu_acpi.c: let custom parameter parsing routines return errno

Modify the custom parameter parsing routines in:

xen/drivers/passthrough/amd/iommu_acpi.c

to indicate whether the parameter value was parsed successfully.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Juergen Gross authored and Jan Beulich committed 2017-08-25 16:19:51 +02:00
1 parent 6a48b87e7f
commit 071ff8ae8a
1 file changed
+17 -9
+17 -9
View File
@@ -632,21 +632,23 @@ static u16 __init parse_ivhd_device_extended_range(
return dev_length;
}
static void __init parse_ivrs_ioapic(char *str)
static int __init parse_ivrs_ioapic(const char *str)
{
const char *s = str;
unsigned long id;
unsigned int seg, bus, dev, func;
unsigned int idx;
ASSERT(*s == '[');
if ( *s != '[' )
return -EINVAL;
id = simple_strtoul(s + 1, &s, 0);
if ( *s != ']' || *++s != '=' )
return;
return -EINVAL;
s = parse_pci(s + 1, &seg, &bus, &dev, &func);
if ( !s || *s )
return;
return -EINVAL;
idx = ioapic_id_to_index(id);
if ( idx == MAX_IO_APICS )
@@ -655,7 +657,7 @@ static void __init parse_ivrs_ioapic(char *str)
if ( idx == MAX_IO_APICS )
{
printk(XENLOG_ERR "Error: %s: Too many IO APICs.\n", __func__);
return;
return -EINVAL;
}
}
@@ -663,28 +665,34 @@ static void __init parse_ivrs_ioapic(char *str)
ioapic_sbdf[idx].seg = seg;
ioapic_sbdf[idx].id = id;
ioapic_sbdf[idx].cmdline = true;
return 0;
}
custom_param("ivrs_ioapic[", parse_ivrs_ioapic);
static void __init parse_ivrs_hpet(char *str)
static int __init parse_ivrs_hpet(const char *str)
{
const char *s = str;
unsigned long id;
unsigned int seg, bus, dev, func;
ASSERT(*s == '[');
if ( *s != '[' )
return -EINVAL;
id = simple_strtoul(s + 1, &s, 0);
if ( id != (typeof(hpet_sbdf.id))id || *s != ']' || *++s != '=' )
return;
return -EINVAL;
s = parse_pci(s + 1, &seg, &bus, &dev, &func);
if ( !s || *s )
return;
return -EINVAL;
hpet_sbdf.id = id;
hpet_sbdf.bdf = PCI_BDF(bus, dev, func);
hpet_sbdf.seg = seg;
hpet_sbdf.init = HPET_CMDL;
return 0;
}
custom_param("ivrs_hpet[", parse_ivrs_hpet);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.