From 621ff94d5074d88253a5818c6b9c4db718fbfc65 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Mon, 13 Jun 2016 18:57:56 -0300 Subject: error: Remove NULL checks on error_propagate() calls error_propagate() already ignores local_err==NULL, so there's no need to check it before calling. Coccinelle patch used to perform the changes added to scripts/coccinelle/error_propagate_null.cocci. Reviewed-by: Eric Blake Acked-by: Cornelia Huck Reviewed-by: Markus Armbruster Signed-off-by: Eduardo Habkost Message-Id: <1465855078-19435-2-git-send-email-ehabkost@redhat.com> Signed-off-by: Markus Armbruster --- block/qcow2.c | 4 +--- block/quorum.c | 4 +--- block/raw-posix.c | 16 ++++------------ block/raw_bsd.c | 4 +--- block/snapshot.c | 4 +--- 5 files changed, 8 insertions(+), 24 deletions(-) (limited to 'block') diff --git a/block/qcow2.c b/block/qcow2.c index 4718f8250e..23f666d4ae 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2403,9 +2403,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp) ret = qcow2_create2(filename, size, backing_file, backing_fmt, flags, cluster_size, prealloc, opts, version, refcount_order, &local_err); - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); finish: g_free(backing_file); diff --git a/block/quorum.c b/block/quorum.c index ec6f3b9059..331b726f97 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -971,9 +971,7 @@ close_exit: exit: qemu_opts_del(opts); /* propagate error */ - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); return ret; } diff --git a/block/raw-posix.c b/block/raw-posix.c index aacf13203f..a825a0a9f5 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -587,9 +587,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, s->type = FTYPE_FILE; ret = raw_open_common(bs, options, flags, 0, &local_err); - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); return ret; } @@ -2236,9 +2234,7 @@ hdev_open_Mac_error: ret = raw_open_common(bs, options, flags, 0, &local_err); if (ret < 0) { - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); #if defined(__APPLE__) && defined(__MACH__) if (*bsd_path) { filename = bsd_path; @@ -2450,9 +2446,7 @@ static int cdrom_open(BlockDriverState *bs, QDict *options, int flags, /* 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); - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); return ret; } @@ -2571,9 +2565,7 @@ static int cdrom_open(BlockDriverState *bs, QDict *options, int flags, ret = raw_open_common(bs, options, flags, 0, &local_err); if (ret) { - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); return ret; } diff --git a/block/raw_bsd.c b/block/raw_bsd.c index b1d5237135..5af11b6621 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -194,9 +194,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp) int ret; ret = bdrv_create_file(filename, opts, &local_err); - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); return ret; } diff --git a/block/snapshot.c b/block/snapshot.c index da89d2b085..bf5c2ca5e1 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -358,9 +358,7 @@ int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs, ret = bdrv_snapshot_load_tmp(bs, NULL, id_or_name, &local_err); } - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); return ret; } -- cgit v1.2.3