mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] checks for return value during the initcall
@ 2011-07-16  8:02 Vikram Narayanan
  2011-07-18  4:46 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 4+ messages in thread
From: Vikram Narayanan @ 2011-07-16  8:02 UTC (permalink / raw)
  To: barebox

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@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 0;
 }
 
-- 
Thanks,
Vikram



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checks for return value during the initcall
  2011-07-16  8:02 [PATCH] checks for return value during the initcall Vikram Narayanan
@ 2011-07-18  4:46 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-18 17:30   ` Vikram Narayanan
  2011-08-07 11:17   ` Vikram Narayanan
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-18  4:46 UTC (permalink / raw)
  To: Vikram Narayanan; +Cc: barebox

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@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

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checks for return value during the initcall
  2011-07-18  4:46 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-18 17:30   ` Vikram Narayanan
  2011-08-07 11:17   ` Vikram Narayanan
  1 sibling, 0 replies; 4+ messages in thread
From: Vikram Narayanan @ 2011-07-18 17:30 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Mon, Jul 18, 2011 at 10:16 AM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@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@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.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checks for return value during the initcall
  2011-07-18  4:46 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-18 17:30   ` Vikram Narayanan
@ 2011-08-07 11:17   ` Vikram Narayanan
  1 sibling, 0 replies; 4+ messages in thread
From: Vikram Narayanan @ 2011-08-07 11:17 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Mon, 2011-07-18 at 06:46 +0200, Jean-Christophe PLAGNIOL-VILLARD
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@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
Please see if this is ok. 

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
---
 common/console.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/common/console.c b/common/console.c
index d60e57f..3a76320 100644
--- a/common/console.c
+++ b/common/console.c
@@ -118,6 +118,11 @@ 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)
+	{
+		PUTS_LL("Memory allocation failed in getc_buffer_flush\n");
+		return -ENOMEM;
+	}
 	return 0;
 }
 
-- 
1.7.2.3



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-07 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-16  8:02 [PATCH] checks for return value during the initcall Vikram Narayanan
2011-07-18  4:46 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 17:30   ` Vikram Narayanan
2011-08-07 11:17   ` Vikram Narayanan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox