qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] scsi-generic: Simplify error handling code
Date: Thu, 18 Jan 2018 09:20:54 +0100	[thread overview]
Message-ID: <d1dd1750-c487-be35-05eb-ffb12f18e805@redhat.com> (raw)
In-Reply-To: <20180118025245.13042-1-famz@redhat.com>

On 18/01/2018 03:52, Fam Zheng wrote:
> Coverity doesn't like the ignored return value introduced in
> 9d3b155186c278 (hw/block: Fix the return type), and other callers are
> converted already in ceff3e1f01.
> 
> This one was added lately in d9bcd6f7f23a and missed the train. Do it
> now.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  hw/scsi/scsi-generic.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
> index ba70c0dc19..7414fe2d67 100644
> --- a/hw/scsi/scsi-generic.c
> +++ b/hw/scsi/scsi-generic.c
> @@ -482,7 +482,6 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
>      int rc;
>      int sg_version;
>      struct sg_scsi_id scsiid;
> -    Error *local_err = NULL;
>  
>      if (!s->conf.blk) {
>          error_setg(errp, "drive property not set");
> @@ -516,11 +515,9 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
>          error_setg(errp, "SG_GET_SCSI_ID ioctl failed");
>          return;
>      }
> -    blkconf_apply_backend_options(&s->conf,
> -                                  blk_is_read_only(s->conf.blk),
> -                                  true, &local_err);
> -    if (local_err) {
> -        error_propagate(errp, local_err);
> +    if (!blkconf_apply_backend_options(&s->conf,
> +                                       blk_is_read_only(s->conf.blk),
> +                                       true, errp)) {
>          return;
>      }
>  
> 

I'm not a fan of bool return types, in general (because "!" is often
success while "< 0" is failure) and especially when there is an Error**;
I disagree with commit 9d3b155186.  But the function is not in an area I
maintain so I'm queuing this, thanks.

Paolo

  parent reply	other threads:[~2018-01-18  8:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18  2:52 [Qemu-devel] [PATCH] scsi-generic: Simplify error handling code Fam Zheng
2018-01-18  4:34 ` Philippe Mathieu-Daudé
2018-01-18  8:20 ` Paolo Bonzini [this message]
2018-01-18 11:21   ` Philippe Mathieu-Daudé
2018-01-18 12:03     ` Paolo Bonzini
2018-01-18 15:55       ` Philippe Mathieu-Daudé
2018-01-18 15:59         ` Paolo Bonzini
2018-01-18 20:34         ` Eric Blake
2018-01-18 21:38           ` Eduardo Habkost
2018-01-18 22:19             ` Paolo Bonzini
2018-01-18 22:39               ` Eduardo Habkost

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=d1dd1750-c487-be35-05eb-ffb12f18e805@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).