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

Commit cb75d25f authored by Praneeth Paladugu's avatar Praneeth Paladugu
Browse files

msm: vidc: Add NULL check for bus vote data allocation



While allocating bus vote data, add NULL check to make sure that
failure of malloc is handled properly.

CRs-Fixed: 2115630
Change-Id: If9cf41003d03ccc067f2c2fda324e1e5546e677a
Signed-off-by: default avatarPraneeth Paladugu <ppaladug@codeaurora.org>
parent 5b93813a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1693,6 +1693,12 @@ static int venus_hfi_core_init(void *device)

	dev->bus_vote.data =
		kzalloc(sizeof(struct vidc_bus_vote_data), GFP_KERNEL);
	if (!dev->bus_vote.data) {
		dprintk(VIDC_ERR, "Bus vote data memory is not allocated\n");
		rc = -ENOMEM;
		goto err_no_mem;
	}

	dev->bus_vote.data_count = 1;
	dev->bus_vote.data->power_mode = VIDC_POWER_TURBO;

@@ -1770,6 +1776,7 @@ static int venus_hfi_core_init(void *device)
	__set_state(dev, VENUS_STATE_DEINIT);
	__unload_fw(dev);
err_load_fw:
err_no_mem:
	dprintk(VIDC_ERR, "Core init failed\n");
	mutex_unlock(&dev->lock);
	return rc;