mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] EFI: fix error handling in efi_get_boot()
@ 2014-08-12  9:37 Michael Olbrich
  2014-08-12  9:37 ` [PATCH 2/2] EFI: handle more boot devices Michael Olbrich
  2014-09-01  9:03 ` [PATCH 1/2] EFI: fix error handling in efi_get_boot() Sascha Hauer
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Olbrich @ 2014-08-12  9:37 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich

efi_get_global_var() returns an error code, not NULL when it fails.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
 arch/efi/efi/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
index ff97783..7de8ec8 100644
--- a/arch/efi/efi/efi.c
+++ b/arch/efi/efi/efi.c
@@ -104,7 +104,7 @@ struct efi_boot *efi_get_boot(int num)
 
 	free(name);
 
-	if (!buf) {
+	if (IS_ERR(buf)) {
 		free(boot);
 		return NULL;
 	}
-- 
2.0.1


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

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

* [PATCH 2/2] EFI: handle more boot devices
  2014-08-12  9:37 [PATCH 1/2] EFI: fix error handling in efi_get_boot() Michael Olbrich
@ 2014-08-12  9:37 ` Michael Olbrich
  2014-09-01  9:06   ` Sascha Hauer
  2014-09-01  9:03 ` [PATCH 1/2] EFI: fix error handling in efi_get_boot() Sascha Hauer
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2014-08-12  9:37 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich

efi_get_boot() fails for partitions that are not supported, so errors must
be ignored to find all supported devices.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---

I'm not sure about this one. We're not doing anythings with the return
value of efi_get_boot(), so this is just some debug output + memory leak.

Also, 100 is rather arbitrary. Maybe EFI has some limit there as well?

Michael

 arch/efi/efi/efi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
index 7de8ec8..ceb4479 100644
--- a/arch/efi/efi/efi.c
+++ b/arch/efi/efi/efi.c
@@ -134,9 +134,10 @@ struct efi_boot *efi_get_boot(int num)
 
 static int misc_init(void)
 {
-	efi_get_boot(1);
-	efi_get_boot(2);
-	efi_get_boot(3);
+	int i;
+
+	for (i = 1; i < 100; ++i)
+		efi_get_boot(i);
 
 	return 0;
 }
-- 
2.0.1


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

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

* Re: [PATCH 1/2] EFI: fix error handling in efi_get_boot()
  2014-08-12  9:37 [PATCH 1/2] EFI: fix error handling in efi_get_boot() Michael Olbrich
  2014-08-12  9:37 ` [PATCH 2/2] EFI: handle more boot devices Michael Olbrich
@ 2014-09-01  9:03 ` Sascha Hauer
  1 sibling, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-09-01  9:03 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox

On Tue, Aug 12, 2014 at 11:37:20AM +0200, Michael Olbrich wrote:
> efi_get_global_var() returns an error code, not NULL when it fails.
> 
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>

Applied this one, thanks

Sascha

> ---
>  arch/efi/efi/efi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
> index ff97783..7de8ec8 100644
> --- a/arch/efi/efi/efi.c
> +++ b/arch/efi/efi/efi.c
> @@ -104,7 +104,7 @@ struct efi_boot *efi_get_boot(int num)
>  
>  	free(name);
>  
> -	if (!buf) {
> +	if (IS_ERR(buf)) {
>  		free(boot);
>  		return NULL;
>  	}
> -- 
> 2.0.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH 2/2] EFI: handle more boot devices
  2014-08-12  9:37 ` [PATCH 2/2] EFI: handle more boot devices Michael Olbrich
@ 2014-09-01  9:06   ` Sascha Hauer
  2014-09-01 10:02     ` Michael Olbrich
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2014-09-01  9:06 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox

On Tue, Aug 12, 2014 at 11:37:21AM +0200, Michael Olbrich wrote:
> efi_get_boot() fails for partitions that are not supported, so errors must
> be ignored to find all supported devices.
> 
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
> 
> I'm not sure about this one. We're not doing anythings with the return
> value of efi_get_boot(), so this is just some debug output + memory leak.

So maybe we should rather comment out the code until we do something
meaningful with it?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH 2/2] EFI: handle more boot devices
  2014-09-01  9:06   ` Sascha Hauer
@ 2014-09-01 10:02     ` Michael Olbrich
  2014-09-01 10:12       ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2014-09-01 10:02 UTC (permalink / raw)
  To: barebox

On Mon, Sep 01, 2014 at 11:06:19AM +0200, Sascha Hauer wrote:
> On Tue, Aug 12, 2014 at 11:37:21AM +0200, Michael Olbrich wrote:
> > efi_get_boot() fails for partitions that are not supported, so errors must
> > be ignored to find all supported devices.
> > 
> > Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> > ---
> > 
> > I'm not sure about this one. We're not doing anythings with the return
> > value of efi_get_boot(), so this is just some debug output + memory leak.
> 
> So maybe we should rather comment out the code until we do something
> meaningful with it?

I don't care either way. What's this stuff for anyways?

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH 2/2] EFI: handle more boot devices
  2014-09-01 10:02     ` Michael Olbrich
@ 2014-09-01 10:12       ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2014-09-01 10:12 UTC (permalink / raw)
  To: barebox

On Mon, Sep 01, 2014 at 12:02:00PM +0200, Michael Olbrich wrote:
> On Mon, Sep 01, 2014 at 11:06:19AM +0200, Sascha Hauer wrote:
> > On Tue, Aug 12, 2014 at 11:37:21AM +0200, Michael Olbrich wrote:
> > > efi_get_boot() fails for partitions that are not supported, so errors must
> > > be ignored to find all supported devices.
> > > 
> > > Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> > > ---
> > > 
> > > I'm not sure about this one. We're not doing anythings with the return
> > > value of efi_get_boot(), so this is just some debug output + memory leak.
> > 
> > So maybe we should rather comment out the code until we do something
> > meaningful with it?
> 
> I don't care either way. What's this stuff for anyways?

These variables contain the boot order. I added this stuff to verify
that I can read EFI variables.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2014-09-01 10:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-12  9:37 [PATCH 1/2] EFI: fix error handling in efi_get_boot() Michael Olbrich
2014-08-12  9:37 ` [PATCH 2/2] EFI: handle more boot devices Michael Olbrich
2014-09-01  9:06   ` Sascha Hauer
2014-09-01 10:02     ` Michael Olbrich
2014-09-01 10:12       ` Sascha Hauer
2014-09-01  9:03 ` [PATCH 1/2] EFI: fix error handling in efi_get_boot() Sascha Hauer

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