qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] mirror: drop local_err in mirror_complete
Date: Sat, 19 Oct 2013 10:05:25 +0200	[thread overview]
Message-ID: <20131019080525.GA2727@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <52617702.1080906@redhat.com>

Am 18.10.2013 um 19:59 hat Max Reitz geschrieben:
> Then there's still the problem that I'm not the one who introduced
> error_propagate. Someone obviously intended some purpose for it, so
> even if it doesn't make a difference now (and my RFC is unneeded),
> I'd still use it to propagate errors (instead of passing the error
> pointer). My point being that there *is* a function for propagating
> errors and I think we should therefore use it. The current qemu code
> seems to alternate between the two alternatives, although using
> error_propagate seems more common to me (at least, that was the
> result when I looked through the code trying to decide whether to
> use it or not).
> 
> Generally, we need a proper discussion about whether error_propagate
> is obsolete or not. Afterwards, we can adapt the current codebase to
> the result of that discussion; but until then, I oppose changing
> existing code without actual need to do so but personal preference.
> 
> Max
> 
> 
> PS: I wrote my error_propagate RFC in part because I was
> disappointed about how much of a no-op error_propagate actually is
> and was trying to change that. ;-)

It's not a no-op. The point is that the caller can pass NULL as errp if
it isn't interested in the error message. If you do anything else with
errp than just passing it to other functions - most commonly a
error_is_set() check - you need to make sure that you use a local Error
variable and propagate it. Otherwise, if the caller passed NULL, your
error path would never get executed.

So in this specific case, not having a local_err and error_propagate()
does work, but it's not generally safe. If in doubt, use local_err.

Regarding this patch, I'm not sure it's useful.

Kevin

  reply	other threads:[~2013-10-19  8:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15  2:23 [Qemu-devel] [PATCH v2] mirror: drop local_err in mirror_complete Fam Zheng
2013-10-15  3:05 ` Eric Blake
2013-10-15  3:12   ` Fam Zheng
2013-10-16 18:56 ` Max Reitz
2013-10-17 12:49   ` Stefan Hajnoczi
2013-10-17 13:00     ` Kevin Wolf
2013-10-18  8:51       ` Fam Zheng
2013-10-18 17:59         ` Max Reitz
2013-10-19  8:05           ` Kevin Wolf [this message]
2013-10-19 20:02             ` Max Reitz
2013-10-19  8:50           ` Paolo Bonzini
2013-10-18  8:52       ` Stefan Hajnoczi
2013-10-17 12:51   ` Stefan Hajnoczi

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=20131019080525.GA2727@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=famz@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --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).