qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Suramya Shah <shah.suramya@gmail.com>, qemu-devel@nongnu.org
Cc: marcel@redhat.com, gxt@mprc.pku.edu.cn
Subject: Re: [Qemu-devel] [PATCH v5] hw/unicore32: remove wrong assertion in puv machine init
Date: Fri, 31 Mar 2017 14:55:58 +0200	[thread overview]
Message-ID: <6ea9c34f-3dd5-95de-4915-1009215a67c8@redhat.com> (raw)
In-Reply-To: <20170330165008.26419-1-shah.suramya@gmail.com>

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 <shah.suramya@gmail.com>

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

      parent reply	other threads:[~2017-03-31 12:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 16:50 [Qemu-devel] [PATCH v5] hw/unicore32: remove wrong assertion in puv machine init Suramya Shah
2017-03-30 16:52 ` Marcel Apfelbaum
2017-03-31  1:47   ` Xuetao Guan
2017-03-31 12:55 ` Thomas Huth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ea9c34f-3dd5-95de-4915-1009215a67c8@redhat.com \
    --to=thuth@redhat.com \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=marcel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shah.suramya@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).