aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2016-06-13 18:57:57 -0300
committerMarkus Armbruster <armbru@redhat.com>2016-06-20 16:38:13 +0200
commit6b62d961373e0327f2af8fb77d6d5d6308864180 (patch)
tree540a92df500ef4f4056110a80ae309636ec5756e /block
parent621ff94d5074d88253a5818c6b9c4db718fbfc65 (diff)
downloadqemu-6b62d961373e0327f2af8fb77d6d5d6308864180.zip
qemu-6b62d961373e0327f2af8fb77d6d5d6308864180.tar.gz
qemu-6b62d961373e0327f2af8fb77d6d5d6308864180.tar.bz2
error: Remove unnecessary local_err variables
This patch simplifies code that uses a local_err variable just to immediately use it for an error_propagate() call. Coccinelle patch used to perform the changes added to scripts/coccinelle/remove_local_err.cocci. Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1465855078-19435-3-git-send-email-ehabkost@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Blank line in s390-virtio-ccw.c restored] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/raw-posix.c8
-rw-r--r--block/raw_bsd.c4
2 files changed, 3 insertions, 9 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index a825a0a..dbdabc9 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -582,12 +582,10 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVRawState *s = bs->opaque;
- Error *local_err = NULL;
int ret;
s->type = FTYPE_FILE;
- ret = raw_open_common(bs, options, flags, 0, &local_err);
- error_propagate(errp, local_err);
+ ret = raw_open_common(bs, options, flags, 0, errp);
return ret;
}
@@ -2439,14 +2437,12 @@ static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVRawState *s = bs->opaque;
- Error *local_err = NULL;
int ret;
s->type = FTYPE_CD;
/* open will not fail even if no CD is inserted, so add O_NONBLOCK */
- ret = raw_open_common(bs, options, flags, O_NONBLOCK, &local_err);
- error_propagate(errp, local_err);
+ ret = raw_open_common(bs, options, flags, O_NONBLOCK, errp);
return ret;
}
diff --git a/block/raw_bsd.c b/block/raw_bsd.c
index 5af11b6..b51ac98 100644
--- a/block/raw_bsd.c
+++ b/block/raw_bsd.c
@@ -190,11 +190,9 @@ static int raw_has_zero_init(BlockDriverState *bs)
static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
{
- Error *local_err = NULL;
int ret;
- ret = bdrv_create_file(filename, opts, &local_err);
- error_propagate(errp, local_err);
+ ret = bdrv_create_file(filename, opts, errp);
return ret;
}