[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH v3 22/22] x86/setup: simplify handling of initrdidx when no initrd present
From: David Woodhouse <dwmw@xxxxxxxxxxxx> Remove a ternary operator that made my brain hurt and replace it with something simpler that makes it clearer that the >= mbi->mods_count is because of what find_first_bit() returns when it doesn't find anything. Just have a simple condition to set initrdidx to zero in that case, and a much simpler ternary operator in the create_dom0() call. Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx> --- xen/arch/x86/setup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 53f7b9ced4..6b3a5777cb 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1993,6 +1993,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) else { initrdidx = find_first_bit(module_map, mbi->mods_count); + if ( initrdidx >= mbi->mods_count ) + initrdidx = 0; + if ( bitmap_weight(module_map, mbi->mods_count) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", @@ -2002,8 +2005,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) * safely above our heap. The second module, if present, is an initrd. */ dom0 = create_dom0(mod, modules_headroom, - (initrdidx > 0) && (initrdidx < mbi->mods_count) - ? mod + initrdidx : NULL, kextra, loader); + initrdidx ? mod + initrdidx : NULL, + kextra, loader); if ( dom0 == NULL ) panic("Could not set up DOM0 guest OS\n"); } -- 2.21.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |