[PATCH] checks for return value during the initcall

Vikram Narayanan vikram186 at gmail.com
Mon Jul 18 13:30:27 EDT 2011


On Mon, Jul 18, 2011 at 10:16 AM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj at jcrosoft.com> wrote:
>
> On 13:32 Sat 16 Jul     , Vikram Narayanan wrote:
> > Hi,
> >
> > This patch checks for the return value, if there is no memory allocated in the getc_buffer_flush initcall.
> >
> > Signed-off-by: Vikram Narayanan<vikram186 at gmail.com>
> > ---
> > diff --git a/common/console.c b/common/console.c
> > index d60e57f..c502638 100644
> > --- a/common/console.c
> > +++ b/common/console.c
> > @@ -37,6 +37,7 @@
> >  #include <poller.h>
> >  #include <linux/list.h>
> >  #include <linux/stringify.h>
> > +#include <errno.h>
> >
> >  LIST_HEAD(console_list);
> >  EXPORT_SYMBOL(console_list);
> > @@ -118,6 +119,8 @@ static int getc_buffer_flush(void)
> >  {
> >       console_input_buffer = kfifo_alloc(1024);
> >       console_output_buffer = kfifo_alloc(1024);
> > +     if(!console_input_buffer || !console_output_buffer)
> > +             return ENOMEM;
> return -ENOMEM;
>
> and a DEBUG_LL message is important here for debug
Sure. That would be good. Shall I wait for the PUTS_LL to be added to the git?

-
Thanks,
Vikram
> Best Regards,
> J.



More information about the barebox mailing list