diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-06-20 16:19:18 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-06-20 16:19:18 +0100 |
commit | 7fa124b273acd22a808e742ead78c065ccd9b4c4 (patch) | |
tree | 60fc0c2deebaa7cef45b35f123986eed40f3ba3f /block | |
parent | fd2590bccc0bd63833813592a3e193686cf1c623 (diff) | |
parent | daa76aa416b1e18ab1fac650ff53d966d8f21f68 (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-06-20' into staging
Error reporting patches for 2016-06-20
# gpg: Signature made Mon 20 Jun 2016 15:56:15 BST
# gpg: using RSA key 0x3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-error-2016-06-20:
log: Fix qemu_set_log_filename() error handling
log: Fix qemu_set_dfilter_ranges() error reporting
log: Plug memory leak on multiple -dfilter
coccinelle: Remove unnecessary variables for function return value
error: Remove unnecessary local_err variables
error: Remove NULL checks on error_propagate() calls
vl: Error messages need to go to stderr, fix some
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/archipelago.c | 4 | ||||
-rw-r--r-- | block/qcow2-cluster.c | 6 | ||||
-rw-r--r-- | block/qcow2-refcount.c | 7 | ||||
-rw-r--r-- | block/qcow2.c | 4 | ||||
-rw-r--r-- | block/quorum.c | 4 | ||||
-rw-r--r-- | block/raw-posix.c | 24 | ||||
-rw-r--r-- | block/raw_bsd.c | 9 | ||||
-rw-r--r-- | block/rbd.c | 4 | ||||
-rw-r--r-- | block/snapshot.c | 4 | ||||
-rw-r--r-- | block/vmdk.c | 6 | ||||
-rw-r--r-- | block/vvfat.c | 5 |
11 files changed, 17 insertions, 60 deletions
diff --git a/block/archipelago.c b/block/archipelago.c index b9f5e69d4a..37b8aca78d 100644 --- a/block/archipelago.c +++ b/block/archipelago.c @@ -974,11 +974,9 @@ err_exit2: static int64_t qemu_archipelago_getlength(BlockDriverState *bs) { - int64_t ret; BDRVArchipelagoState *s = bs->opaque; - ret = archipelago_volume_info(s); - return ret; + return archipelago_volume_info(s); } static int qemu_archipelago_truncate(BlockDriverState *bs, int64_t offset) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 893ddf6798..0fb43566fb 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -154,11 +154,9 @@ static int l2_load(BlockDriverState *bs, uint64_t l2_offset, uint64_t **l2_table) { BDRVQcow2State *s = bs->opaque; - int ret; - - ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void**) l2_table); - return ret; + return qcow2_cache_get(bs, s->l2_table_cache, l2_offset, + (void **)l2_table); } /* diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 66f187a74b..3bef410839 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -218,13 +218,10 @@ static int load_refcount_block(BlockDriverState *bs, void **refcount_block) { BDRVQcow2State *s = bs->opaque; - int ret; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_LOAD); - ret = qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset, - refcount_block); - - return ret; + return qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset, + refcount_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..bef7a671a6 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -582,15 +582,9 @@ 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); - if (local_err) { - error_propagate(errp, local_err); - } - return ret; + return raw_open_common(bs, options, flags, 0, errp); } static int raw_reopen_prepare(BDRVReopenState *state, @@ -2236,9 +2230,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; @@ -2443,17 +2435,11 @@ 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); - if (local_err) { - error_propagate(errp, local_err); - } - return ret; + return raw_open_common(bs, options, flags, O_NONBLOCK, errp); } static int cdrom_probe_device(const char *filename) @@ -2571,9 +2557,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..7f637914b7 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -190,14 +190,7 @@ 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); - if (local_err) { - error_propagate(errp, local_err); - } - return ret; + return bdrv_create_file(filename, opts, errp); } static int raw_open(BlockDriverState *bs, QDict *options, int flags, diff --git a/block/rbd.c b/block/rbd.c index 5226b6fef8..0a5840d08b 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -883,10 +883,8 @@ static int qemu_rbd_snap_rollback(BlockDriverState *bs, const char *snapshot_name) { BDRVRBDState *s = bs->opaque; - int r; - r = rbd_snap_rollback(s->image, snapshot_name); - return r; + return rbd_snap_rollback(s->image, snapshot_name); } static int qemu_rbd_snap_list(BlockDriverState *bs, 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; } diff --git a/block/vmdk.c b/block/vmdk.c index ee09423b46..2901692700 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -1260,15 +1260,13 @@ static VmdkExtent *find_extent(BDRVVmdkState *s, static inline uint64_t vmdk_find_offset_in_cluster(VmdkExtent *extent, int64_t offset) { - uint64_t offset_in_cluster, extent_begin_offset, extent_relative_offset; + uint64_t extent_begin_offset, extent_relative_offset; uint64_t cluster_size = extent->cluster_sectors * BDRV_SECTOR_SIZE; extent_begin_offset = (extent->end_sector - extent->sectors) * BDRV_SECTOR_SIZE; extent_relative_offset = offset - extent_begin_offset; - offset_in_cluster = extent_relative_offset % cluster_size; - - return offset_in_cluster; + return extent_relative_offset % cluster_size; } static inline uint64_t vmdk_find_index_in_cluster(VmdkExtent *extent, diff --git a/block/vvfat.c b/block/vvfat.c index 6d2e21ce11..5569450616 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -114,15 +114,12 @@ static inline int array_ensure_allocated(array_t* array, int index) static inline void* array_get_next(array_t* array) { unsigned int next = array->next; - void* result; if (array_ensure_allocated(array, next) < 0) return NULL; array->next = next + 1; - result = array_get(array, next); - - return result; + return array_get(array, next); } static inline void* array_insert(array_t* array,unsigned int index,unsigned int count) { |