All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	kwolf@redhat.com, cornelia.huck@de.ibm.com, mreitz@redhat.com,
	qemu-block@nongnu.org, borntraeger@de.ibm.com
Subject: Re: [Qemu-devel] [PATCH] error: Avoid redudant error_propagate() usage
Date: Thu, 9 Jun 2016 18:59:19 -0300	[thread overview]
Message-ID: <20160609215919.GD18662@thinpad.lan.raisama.net> (raw)
In-Reply-To: <5759D824.7070306@redhat.com>

On Thu, Jun 09, 2016 at 02:57:08PM -0600, Eric Blake wrote:
> On 06/09/2016 02:21 PM, Eduardo Habkost wrote:
> > This patch simplifies code that uses a local_err variable just to immediately
> > use it for an error_propagate() call.
> > 
> > Done using the following Coccinelle patch:
> > 
> 
> > +++ b/block.c
> > @@ -353,7 +353,6 @@ out:
> >  int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
> >  {
> >      BlockDriver *drv;
> > -    Error *local_err = NULL;
> >      int ret;
> >  
> >      drv = bdrv_find_protocol(filename, true, errp);
> > @@ -361,8 +360,7 @@ int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp)
> >          return -ENOENT;
> >      }
> >  
> > -    ret = bdrv_create(drv, filename, opts, &local_err);
> > -    error_propagate(errp, local_err);
> > +    ret = bdrv_create(drv, filename, opts, errp);
> >      return ret;
> 
> And I _know_ there's a Coccinelle recipe for further shortening this
> into 'return bdrv_create(...)' (since it was part of the tutorial class
> at last year's KVM Forum) - again, I don't know the actual syntax to use
> to get it, but it shouldn't be too hard to find in a web search.  Fine
> as yet another followup patch.

This is an easy one. I will give it a try.

Probably v2 will become a 3-patch series.

-- 
Eduardo

      reply	other threads:[~2016-06-09 21:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 17:40 [Qemu-devel] [PATCH] error: Remove NULL checks on error_propagate() calls Eduardo Habkost
2016-06-09 19:37 ` Eric Blake
2016-06-09 19:50   ` Eduardo Habkost
2016-06-09 20:11     ` Eric Blake
2016-06-09 20:21       ` Eduardo Habkost
2016-06-09 20:21   ` [Qemu-devel] [PATCH] error: Avoid redudant error_propagate() usage Eduardo Habkost
2016-06-09 20:47     ` Eduardo Habkost
2016-06-09 20:54       ` Eric Blake
2016-06-09 21:57         ` Eduardo Habkost
2016-06-09 20:57     ` Eric Blake
2016-06-09 21:59       ` Eduardo Habkost [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=20160609215919.GD18662@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.