diff mbox series

[U-Boot,v5,02/13] efi: Init the 'rows' and 'cols' variables

Message ID 20180612052646.109214-3-sjg@chromium.org
State Superseded
Delegated to: Alexander Graf
Headers show
Series efi: Enable basic sandbox support for EFI loader | expand

Commit Message

Simon Glass June 12, 2018, 5:26 a.m. UTC
The current code causes a compiler error on gcc 4.8.4 as used by sandbox
on Ubuntu 14.04, which is fairly recent. Init these variables to fix the
problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v5: None
Changes in v4:
- Move the fix to query_console_serial()

Changes in v3:
- Add new patch to init the 'rows' and 'cols' variables

Changes in v2: None

 lib/efi_loader/efi_console.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Heinrich Schuchardt June 12, 2018, 5:41 a.m. UTC | #1
On 06/12/2018 07:26 AM, Simon Glass wrote:
> The current code causes a compiler error on gcc 4.8.4 as used by sandbox
> on Ubuntu 14.04, which is fairly recent. Init these variables to fix the
> problem.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Is this needed after Alex's
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=80483b2ab62ca7cd200db445b6920ee96d17df88
?

Best regards

Heinrich

> ---
> 
> Changes in v5: None
> Changes in v4:
> - Move the fix to query_console_serial()
> 
> Changes in v3:
> - Add new patch to init the 'rows' and 'cols' variables
> 
> Changes in v2: None
> 
>  lib/efi_loader/efi_console.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
> index ce66c935ec..bd953a1485 100644
> --- a/lib/efi_loader/efi_console.c
> +++ b/lib/efi_loader/efi_console.c
> @@ -204,8 +204,11 @@ static int query_console_serial(int *rows, int *cols)
>  			return -1;
>  
>  	/* Read {depth,rows,cols} */
> -	if (term_read_reply(n, 3, 't'))
> +	if (term_read_reply(n, 3, 't')) {
> +		*rows = -1;
> +		*cols = -1;
>  		return -1;
> +	}
>  
>  	*cols = n[2];
>  	*rows = n[1];
>
Simon Glass June 13, 2018, 3:12 a.m. UTC | #2
Hi,

On 11 June 2018 at 23:41, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> On 06/12/2018 07:26 AM, Simon Glass wrote:
>> The current code causes a compiler error on gcc 4.8.4 as used by sandbox
>> on Ubuntu 14.04, which is fairly recent. Init these variables to fix the
>> problem.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Is this needed after Alex's
> http://git.denx.de/?p=u-boot.git;a=commitdiff;h=80483b2ab62ca7cd200db445b6920ee96d17df88
> ?

I missed that one.

I actually think his is the better fix, since we really shouldn't be
setting return values in case of error.

Regards,
Simon

>
> Best regards
>
> Heinrich
>
>> ---
>>
>> Changes in v5: None
>> Changes in v4:
>> - Move the fix to query_console_serial()
>>
>> Changes in v3:
>> - Add new patch to init the 'rows' and 'cols' variables
>>
>> Changes in v2: None
>>
>>  lib/efi_loader/efi_console.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
>> index ce66c935ec..bd953a1485 100644
>> --- a/lib/efi_loader/efi_console.c
>> +++ b/lib/efi_loader/efi_console.c
>> @@ -204,8 +204,11 @@ static int query_console_serial(int *rows, int *cols)
>>                       return -1;
>>
>>       /* Read {depth,rows,cols} */
>> -     if (term_read_reply(n, 3, 't'))
>> +     if (term_read_reply(n, 3, 't')) {
>> +             *rows = -1;
>> +             *cols = -1;
>>               return -1;
>> +     }
>>
>>       *cols = n[2];
>>       *rows = n[1];
>>
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index ce66c935ec..bd953a1485 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -204,8 +204,11 @@  static int query_console_serial(int *rows, int *cols)
 			return -1;
 
 	/* Read {depth,rows,cols} */
-	if (term_read_reply(n, 3, 't'))
+	if (term_read_reply(n, 3, 't')) {
+		*rows = -1;
+		*cols = -1;
 		return -1;
+	}
 
 	*cols = n[2];
 	*rows = n[1];