Commit 2de70388 authored by Mike Snitzer's avatar Mike Snitzer
Browse files

dm vdo: check for VDO_SUCCESS return value from memory-alloc functions



VDO_SUCCESS and UDS_SUCCESS were used interchangably, update all
callers of VDO's memory-alloc functions to consistently check for
VDO_SUCCESS.

Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent 97d33803
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -223,11 +223,11 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache)

	result = vdo_allocate(cache->page_count, struct page_info, "page infos",
			      &cache->infos);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	result = vdo_allocate_memory(size, VDO_BLOCK_SIZE, "cache pages", &cache->pages);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	result = vdo_int_map_create(cache->page_count, &cache->page_map);
@@ -2874,7 +2874,7 @@ int vdo_decode_block_map(struct block_map_state_2_0 state, block_count_t logical
	result = vdo_allocate_extended(struct block_map,
				       vdo->thread_config.logical_zone_count,
				       struct block_map_zone, __func__, &map);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	map->vdo = vdo;
+1 −1
Original line number Diff line number Diff line
@@ -847,7 +847,7 @@ int make_data_vio_pool(struct vdo *vdo, data_vio_count_t pool_size,

	result = vdo_allocate_extended(struct data_vio_pool, pool_size, struct data_vio,
				       __func__, &pool);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	ASSERT_LOG_ONLY((discard_limit <= pool_size),
+9 −9
Original line number Diff line number Diff line
@@ -280,7 +280,7 @@ static int split_string(const char *string, char separator, char ***substring_ar

	result = vdo_allocate(substring_count + 1, char *, "string-splitting array",
			      &substrings);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	for (s = string; *s != 0; s++) {
@@ -289,7 +289,7 @@ static int split_string(const char *string, char separator, char ***substring_ar

			result = vdo_allocate(length + 1, char, "split string",
					      &substrings[current_substring]);
			if (result != UDS_SUCCESS) {
			if (result != VDO_SUCCESS) {
				free_string_array(substrings);
				return result;
			}
@@ -310,7 +310,7 @@ static int split_string(const char *string, char separator, char ***substring_ar

	result = vdo_allocate(length + 1, char, "split string",
			      &substrings[current_substring]);
	if (result != UDS_SUCCESS) {
	if (result != VDO_SUCCESS) {
		free_string_array(substrings);
		return result;
	}
@@ -1527,7 +1527,7 @@ static size_t get_bit_array_size(unsigned int bit_count)
 * Since the array is initially NULL, this also initializes the array the first time we allocate an
 * instance number.
 *
 * Return: UDS_SUCCESS or an error code from the allocation
 * Return: VDO_SUCCESS or an error code from the allocation
 */
static int grow_bit_array(void)
{
@@ -1540,19 +1540,19 @@ static int grow_bit_array(void)
				       get_bit_array_size(instances.bit_count),
				       get_bit_array_size(new_count),
				       "instance number bit array", &new_words);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	instances.bit_count = new_count;
	instances.words = new_words;
	return UDS_SUCCESS;
	return VDO_SUCCESS;
}

/**
 * allocate_instance() - Allocate an instance number.
 * @instance_ptr: A point to hold the instance number
 *
 * Return: UDS_SUCCESS or an error code
 * Return: VDO_SUCCESS or an error code
 *
 * This function must be called while holding the instances lock.
 */
@@ -1564,7 +1564,7 @@ static int allocate_instance(unsigned int *instance_ptr)
	/* If there are no unallocated instances, grow the bit array. */
	if (instances.count >= instances.bit_count) {
		result = grow_bit_array();
		if (result != UDS_SUCCESS)
		if (result != VDO_SUCCESS)
			return result;
	}

@@ -1587,7 +1587,7 @@ static int allocate_instance(unsigned int *instance_ptr)
	instances.count++;
	instances.next = instance + 1;
	*instance_ptr = instance;
	return UDS_SUCCESS;
	return VDO_SUCCESS;
}

static int construct_new_vdo_registered(struct dm_target *ti, unsigned int argc,
+1 −1
Original line number Diff line number Diff line
@@ -800,7 +800,7 @@ static int allocate_partition(struct layout *layout, u8 id,
	int result;

	result = vdo_allocate(1, struct partition, __func__, &partition);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	partition->id = id;
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ int uds_make_funnel_queue(struct funnel_queue **queue_ptr)
	struct funnel_queue *queue;

	result = vdo_allocate(1, struct funnel_queue, "funnel queue", &queue);
	if (result != UDS_SUCCESS)
	if (result != VDO_SUCCESS)
		return result;

	/*
Loading