Re: [RESEND PATCH] x86: return proper error code

From: Pekka Enberg
Date: Thu Sep 30 2010 - 15:49:41 EST


On Thu, Sep 30, 2010 at 10:43 PM, Davidlohr Bueso <dave@xxxxxxx> wrote:
> x86: return -ENOMEM instead of -1 when returning on memory allocation errors in add_kmmio_fault_page()
>
> Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
> ---
>  arch/x86/mm/kmmio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
> index e5d5e2c..36a4347 100644
> --- a/arch/x86/mm/kmmio.c
> +++ b/arch/x86/mm/kmmio.c
> @@ -370,7 +370,7 @@ static int add_kmmio_fault_page(unsigned long page)
>
>        f = kzalloc(sizeof(*f), GFP_ATOMIC);
>        if (!f)
> -               return -1;
> +               return -ENOMEM;
>
>        f->count = 1;
>        f->page = page;

This doesn't matter much as register_kmmio_probe() doesn't do anything
sane with the error code and ioremap_trace_core() ignores what
register_mmio_probe() does completely. I'd either keep the code as-is
or try to fix up the fishy error handling properly.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/