diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2016-06-13 18:57:58 -0300 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-06-20 16:38:13 +0200 |
commit | 9be385980d37e8f4fd33f605f5fb1c3d144170a8 (patch) | |
tree | d4516d2305c01fabda776667acdb48c48cb105af /block | |
parent | 6b62d961373e0327f2af8fb77d6d5d6308864180 (diff) |
coccinelle: Remove unnecessary variables for function return value
Use Coccinelle script to replace 'ret = E; return ret' with
'return E'. The script will do the substitution only when the
function return type and variable type are the same.
Manual fixups:
* audio/audio.c: coding style of "read (...)" and "write (...)"
* block/qcow2-cluster.c: wrap line to make it shorter
* block/qcow2-refcount.c: change indentation of wrapped line
* target-tricore/op_helper.c: fix coding style of
"remainder|quotient"
* target-mips/dsp_helper.c: reverted changes because I don't
want to argue about checkpatch.pl
* ui/qemu-pixman.c: fix line indentation
* block/rbd.c: restore blank line between declarations and
statements
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1465855078-19435-4-git-send-email-ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Unused Coccinelle rule name dropped along with a redundant comment;
whitespace touched up in block/qcow2-cluster.c; stale commit message
paragraph deleted]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
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/raw-posix.c | 8 | ||||
-rw-r--r-- | block/raw_bsd.c | 5 | ||||
-rw-r--r-- | block/rbd.c | 4 | ||||
-rw-r--r-- | block/vmdk.c | 6 | ||||
-rw-r--r-- | block/vvfat.c | 5 |
8 files changed, 12 insertions, 33 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/raw-posix.c b/block/raw-posix.c index dbdabc9cf1..bef7a671a6 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -582,11 +582,9 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVRawState *s = bs->opaque; - int ret; s->type = FTYPE_FILE; - ret = raw_open_common(bs, options, flags, 0, errp); - return ret; + return raw_open_common(bs, options, flags, 0, errp); } static int raw_reopen_prepare(BDRVReopenState *state, @@ -2437,13 +2435,11 @@ static int cdrom_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVRawState *s = bs->opaque; - 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, errp); - return ret; + return raw_open_common(bs, options, flags, O_NONBLOCK, errp); } static int cdrom_probe_device(const char *filename) diff --git a/block/raw_bsd.c b/block/raw_bsd.c index b51ac98061..7f637914b7 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -190,10 +190,7 @@ static int raw_has_zero_init(BlockDriverState *bs) static int raw_create(const char *filename, QemuOpts *opts, Error **errp) { - int ret; - - ret = bdrv_create_file(filename, opts, errp); - 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/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) { |