qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5] hw/unicore32: remove wrong assertion in puv


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH v5] hw/unicore32: remove wrong assertion in puv machine init
Date: Fri, 31 Mar 2017 14:55:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 30.03.2017 18:50, Suramya Shah wrote:
> Running QEMU with qemu-system-unicore32 without the kernel parameter results 
> in an assertion error.
> Assert should not be used to check user provided parameters. Report an error 
> and exit instead
> Signed-off-by: Suramya Shah <address@hidden>

Nit: There should be a blank line between the description and the
"Signed-off-by" line.
And another nit: Since some people are still using 80-columns terminal
windows, it's also nicer to wrap the description at the 80 columns
barrier (or even 76 columns already) instead.

> ---
>  hw/unicore32/puv3.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 032078f..2c17cc9 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -93,8 +93,11 @@ static void puv3_load_kernel(const char *kernel_filename)
>      if (kernel_filename == NULL && qtest_enabled()) {
>          return;
>      }
> -    assert(kernel_filename != NULL);
> -
> +    if (kernel_filename == NULL) {
> +        error_report("No kernel found");

It's maybe better to give clear instructions to the user, like:
"Need a kernel, please provide one with the '-kernel' option"

> +        exit(1);
> +    }
> +
>      /* only zImage format supported */
>      size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR,
>              KERNEL_MAX_SIZE);
> 

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]