lkml.org 
[lkml]   [2008]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    SubjectRe: 2.6.26-rc7: x86 build error
    Date
    Hi,

    Adrian Bunk <bunk@kernel.org> writes:

    > Commit d3942cff620bea073fc4e3c8ed878eb1e84615ce
    > (x86: use BOOTMEM_EXCLUSIVE on 32-bit)
    > causes the following compile error:
    >
    > <-- snip -->
    >
    > ...
    > CC arch/x86/kernel/setup_32.o
    > /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/x86/kernel/setup_32.c: In function ‘reserve_crashkernel’:
    > /home/bunk/linux/kernel-2.6/git/linux-2.6/arch/x86/kernel/setup_32.c:536: error: void value not ignored as it ought to be
    > make[2]: *** [arch/x86/kernel/setup_32.o] Error 1
    >
    > <-- snip -->
    >
    > CONFIG_KEXEC=y, CONFIG_NEED_MULTIPLE_NODES=y and the fact that
    > reserve_bootmem_node() returns void seems to cause it.

    Yes, this triggers it since reserve_bootmem() is then defined to be
    reserve_bootmem_node() which returns void while the
    !CONFIG_HAVE_ARCH_BOOTMEM_NODE version of reserve_bootmem() in bootmem.c
    already returns int.

    The following fix is needed:

    ---

    From: Bernhard Walle <bwalle@suse.de>
    Subject: Add return value to reserve_bootmem_node()

    This patch changes the function reserve_bootmem_node() from void to int,
    returning -ENOMEM if the allocation fails.


    Signed-off-by: Bernhard Walle <bwalle@suse.de>;

    ---

    Actually, there was a discussion to return -EBUSY instead of -ENOMEM but
    in the end it does not matter, because callsites just check for negative
    return values. -hannes

    include/linux/bootmem.h | 2 +-
    mm/bootmem.c | 6 ++++--
    2 files changed, 5 insertions(+), 3 deletions(-)
    --- a/include/linux/bootmem.h
    +++ b/include/linux/bootmem.h
    @@ -94,7 +94,7 @@ extern unsigned long init_bootmem_node(p
    unsigned long freepfn,
    unsigned long startpfn,
    unsigned long endpfn);
    -extern void reserve_bootmem_node(pg_data_t *pgdat,
    +extern int reserve_bootmem_node(pg_data_t *pgdat,
    unsigned long physaddr,
    unsigned long size,
    int flags);
    --- a/mm/bootmem.c
    +++ b/mm/bootmem.c
    @@ -442,15 +442,17 @@ unsigned long __init init_bootmem_node(p
    return init_bootmem_core(pgdat, freepfn, startpfn, endpfn);
    }

    -void __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
    +int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
    unsigned long size, int flags)
    {
    int ret;

    ret = can_reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
    if (ret < 0)
    - return;
    + return -ENOMEM;
    reserve_bootmem_core(pgdat->bdata, physaddr, size, flags);
    +
    + return 0;
    }

    void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr,
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2008-06-21 19:05    [W:0.038 / U:0.292 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site