Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbd45f20 authored by Siena Richard's avatar Siena Richard Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: qdsp6v2: completely deallocate on cal block creation failure



Completely deallocate the cal block if creation fails to ensure no
memory leaks are present.

CRs-Fixed: 1112751
Change-Id: I76916c8b3f7e8e9b864dc39dab96f7d330774473
Signed-off-by: default avatarSiena Richard <sienar@codeaurora.org>
parent 25010e76
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -601,7 +601,6 @@ static struct cal_block_data *create_cal_block(struct cal_type_data *cal_type,
	}

	INIT_LIST_HEAD(&cal_block->list);
	list_add_tail(&cal_block->list, &cal_type->cal_blocks);

	cal_block->map_data.ion_map_handle = basic_cal->cal_data.mem_handle;
	if (basic_cal->cal_data.mem_handle > 0) {
@@ -633,6 +632,7 @@ static struct cal_block_data *create_cal_block(struct cal_type_data *cal_type,
		goto err;
	}
	cal_block->buffer_number = basic_cal->cal_hdr.buffer_number;
	list_add_tail(&cal_block->list, &cal_type->cal_blocks);
	pr_debug("%s: created block for cal type %d, buf num %d, map handle %d, map size %zd paddr 0x%pK!\n",
		__func__, cal_type->info.reg.cal_type,
		cal_block->buffer_number,
@@ -642,6 +642,8 @@ static struct cal_block_data *create_cal_block(struct cal_type_data *cal_type,
done:
	return cal_block;
err:
	kfree(cal_block->cal_info);
	kfree(cal_block->client_info);
	kfree(cal_block);
	cal_block = NULL;
	return cal_block;