@@ -1895,7 +1895,7 @@ static int handle_aiocb_discard(void *opaque)
* Returns: 0 on success, -errno on failure. Since this is an optimization,
* caller may ignore failures.
*/
-static int allocate_first_block(int fd, size_t max_size)
+static void allocate_first_block(int fd, size_t max_size)
{
size_t write_size = (max_size < MAX_BLOCKSIZE)
? BDRV_SECTOR_SIZE
@@ -1903,7 +1903,6 @@ static int allocate_first_block(int fd, size_t max_size)
size_t max_align = MAX(MAX_BLOCKSIZE, qemu_real_host_page_size());
void *buf;
ssize_t n;
- int ret;
buf = qemu_memalign(max_align, write_size);
memset(buf, 0, write_size);
@@ -1912,10 +1911,7 @@ static int allocate_first_block(int fd, size_t max_size)
n = pwrite(fd, buf, write_size, 0);
} while (n == -1 && errno == EINTR);
- ret = (n == -1) ? -errno : 0;
-
qemu_vfree(buf);
- return ret;
}
static int handle_aiocb_truncate(void *opaque)
@@ -934,20 +934,18 @@ void bdrv_dec_in_flight(BlockDriverState *bs)
bdrv_wakeup(bs);
}
-static bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self)
+static void coroutine_fn
+bdrv_wait_serialising_requests(BdrvTrackedRequest *self)
{
BlockDriverState *bs = self->bs;
- bool waited = false;
if (!qatomic_read(&bs->serialising_in_flight)) {
- return false;
+ return;
}
qemu_co_mutex_lock(&bs->reqs_lock);
- waited = bdrv_wait_serialising_requests_locked(self);
+ bdrv_wait_serialising_requests_locked(self);
qemu_co_mutex_unlock(&bs->reqs_lock);
-
- return waited;
}
bool coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req,
@@ -1689,10 +1687,10 @@ static bool bdrv_init_padding(BlockDriverState *bs,
return true;
}
-static int bdrv_padding_rmw_read(BdrvChild *child,
- BdrvTrackedRequest *req,
- BdrvRequestPadding *pad,
- bool zero_middle)
+static void bdrv_padding_rmw_read(BdrvChild *child,
+ BdrvTrackedRequest *req,
+ BdrvRequestPadding *pad,
+ bool zero_middle)
{
QEMUIOVector local_qiov;
BlockDriverState *bs = child->bs;
@@ -1715,7 +1713,7 @@ static int bdrv_padding_rmw_read(BdrvChild *child,
ret = bdrv_aligned_preadv(child, req, req->overlap_offset, bytes,
align, &local_qiov, 0, 0);
if (ret < 0) {
- return ret;
+ return;
}
if (pad->head) {
bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_HEAD);
@@ -1738,7 +1736,7 @@ static int bdrv_padding_rmw_read(BdrvChild *child,
req->overlap_offset + req->overlap_bytes - align,
align, align, &local_qiov, 0, 0);
if (ret < 0) {
- return ret;
+ return;
}
bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL);
}
@@ -1748,7 +1746,7 @@ zero_mem:
memset(pad->buf + pad->head, 0, pad->buf_len - pad->head - pad->tail);
}
- return 0;
+ return;
}
static void bdrv_padding_destroy(BdrvRequestPadding *pad)
@@ -257,14 +257,14 @@ fail:
return ret;
}
-static int free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
+static void free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
{
int ret;
uint64_t *bitmap_table;
ret = bitmap_table_load(bs, tb, &bitmap_table);
if (ret < 0) {
- return ret;
+ return;
}
clear_bitmap_table(bs, bitmap_table, tb->size);
@@ -274,8 +274,6 @@ static int free_bitmap_clusters(BlockDriverState *bs, Qcow2BitmapTable *tb)
tb->offset = 0;
tb->size = 0;
-
- return 0;
}
/* load_bitmap_data
@@ -293,7 +293,7 @@ static void quorum_rewrite_entry(void *opaque)
}
}
-static bool quorum_rewrite_bad_versions(QuorumAIOCB *acb,
+static void quorum_rewrite_bad_versions(QuorumAIOCB *acb,
QuorumVoteValue *value)
{
QuorumVoteVersion *version;
@@ -331,9 +331,6 @@ static bool quorum_rewrite_bad_versions(QuorumAIOCB *acb,
qemu_coroutine_enter(co);
}
}
-
- /* return true if any rewrite is done else false */
- return count;
}
static void quorum_count_vote(QuorumVotes *votes,
@@ -777,11 +777,10 @@ static int coroutine_fn vpc_co_block_status(BlockDriverState *bs,
* Note that the geometry doesn't always exactly match total_sectors but
* may round it down.
*
- * Returns 0 on success, -EFBIG if the size is larger than 2040 GiB. Override
- * the hardware EIDE and ATA-2 limit of 16 heads (max disk size of 127 GB)
- * and instead allow up to 255 heads.
+ * Override the hardware EIDE and ATA-2 limit of 16 heads (max disk size of 127
+ * GB) and instead allow up to 255 heads.
*/
-static int calculate_geometry(int64_t total_sectors, uint16_t *cyls,
+static void calculate_geometry(int64_t total_sectors, uint16_t *cyls,
uint8_t *heads, uint8_t *secs_per_cyl)
{
uint32_t cyls_times_heads;
@@ -815,8 +814,6 @@ static int calculate_geometry(int64_t total_sectors, uint16_t *cyls,
}
*cyls = cyls_times_heads / *heads;
-
- return 0;
}
static int create_dynamic_disk(BlockBackend *blk, VHDFooter *footer,
@@ -154,9 +154,9 @@ static inline int array_remove_slice(array_t* array,int index, int count)
return 0;
}
-static int array_remove(array_t* array,int index)
+static void array_remove(array_t* array,int index)
{
- return array_remove_slice(array, index, 1);
+ array_remove_slice(array, index, 1);
}
/* return the index for a given member */
@@ -2967,13 +2967,12 @@ DLOG(checkpoint());
return 0;
}
-static int try_commit(BDRVVVFATState* s)
+static void try_commit(BDRVVVFATState* s)
{
vvfat_close_current_file(s);
DLOG(checkpoint());
- if(!is_consistent(s))
- return -1;
- return do_commit(s);
+ if (is_consistent(s))
+ do_commit(s);
}
static int vvfat_write(BlockDriverState *bs, int64_t sector_num,
Make some non-void static functions whose return values are ignored by all callers return void instead. These functions were found by the shiny new static-analyzer.py. Only a few of the reported cases were fixed. Signed-off-by: Alberto Faria <afaria@redhat.com> --- block/file-posix.c | 6 +----- block/io.c | 24 +++++++++++------------- block/qcow2-bitmap.c | 6 ++---- block/quorum.c | 5 +---- block/vpc.c | 9 +++------ block/vvfat.c | 11 +++++------ 6 files changed, 23 insertions(+), 38 deletions(-)