diff mbox series

[07/10] hw/core: skip loading debug on all failures

Message ID 20231115205542.3092038-8-alex.bennee@linaro.org
State Superseded
Headers show
Series random fixes for 8.2 (tests, plugins, docs, semihosting) | expand

Commit Message

Alex Bennée Nov. 15, 2023, 8:55 p.m. UTC
ELF_LOAD_FAILED is one of many negative return codes we can have. Lets
treat any positive size_t as a success for loading.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 hw/core/loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Henderson Nov. 15, 2023, 9:11 p.m. UTC | #1
On 11/15/23 12:55, Alex Bennée wrote:
> ELF_LOAD_FAILED is one of many negative return codes we can have. Lets
> treat any positive size_t as a success for loading.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   hw/core/loader.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

> 
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index 3c79283777..e7a9b3775b 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -505,7 +505,7 @@ ssize_t load_elf_ram_sym(const char *filename,
>                            clear_lsb, data_swab, as, load_rom, sym_cb);
>       }
>   
> -    if (ret != ELF_LOAD_FAILED) {
> +    if (ret > 0) {
>           debuginfo_report_elf(filename, fd, 0);
>       }
>
Philippe Mathieu-Daudé Nov. 15, 2023, 10:41 p.m. UTC | #2
On 15/11/23 21:55, Alex Bennée wrote:
> ELF_LOAD_FAILED is one of many negative return codes we can have. Lets
> treat any positive size_t as a success for loading.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   hw/core/loader.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/core/loader.c b/hw/core/loader.c
index 3c79283777..e7a9b3775b 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -505,7 +505,7 @@  ssize_t load_elf_ram_sym(const char *filename,
                          clear_lsb, data_swab, as, load_rom, sym_cb);
     }
 
-    if (ret != ELF_LOAD_FAILED) {
+    if (ret > 0) {
         debuginfo_report_elf(filename, fd, 0);
     }