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

Commit b121b58d authored by Rishabh Jain's avatar Rishabh Jain Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: ope: Use vzalloc to allocate the write bus ctx structure



Kzalloc doesn't gaurantee for the allocation for memory with
order more than 3. So using vzalloc to allocate the memory.

CRs-Fixed: 2608914
Change-Id: I085afa8a74995593bdff691b9f3c0d83221da3da
Signed-off-by: default avatarRishabh Jain <risjai@codeaurora.org>
parent 7f9157d8
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ static int cam_ope_bus_wr_release(struct ope_hw *ope_hw_info,
		return -EINVAL;
	}

	kzfree(wr_info->bus_wr_ctx[ctx_id]);
	vfree(wr_info->bus_wr_ctx[ctx_id]);
	wr_info->bus_wr_ctx[ctx_id] = NULL;

	return rc;
@@ -556,8 +556,7 @@ static int cam_ope_bus_wr_acquire(struct ope_hw *ope_hw_info,
		return -EINVAL;
	}

	wr_info->bus_wr_ctx[ctx_id] = kzalloc(sizeof(struct ope_bus_wr_ctx),
		GFP_KERNEL);
	wr_info->bus_wr_ctx[ctx_id] = vzalloc(sizeof(struct ope_bus_wr_ctx));
	if (!wr_info->bus_wr_ctx[ctx_id]) {
		CAM_ERR(CAM_OPE, "Out of memory");
		return -ENOMEM;
+3 −6
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
 */

#include <linux/of.h>
@@ -310,14 +310,11 @@ static int cam_ope_dev_process_acquire(struct ope_hw *ope_hw, void *cmd_args)
	return 0;

bus_wr_acquire_fail:
	rc = cam_ope_bus_rd_process(ope_hw, ope_dev_acquire->ctx_id,
	cam_ope_bus_rd_process(ope_hw, ope_dev_acquire->ctx_id,
		OPE_HW_RELEASE, ope_dev_acquire->ope_acquire);
bus_rd_acquire_fail:
	rc = cam_ope_top_process(ope_hw, ope_dev_acquire->ctx_id,
	cam_ope_top_process(ope_hw, ope_dev_acquire->ctx_id,
		OPE_HW_RELEASE, ope_dev_acquire->ope_acquire);
	if (rc)
		goto top_acquire_fail;

top_acquire_fail:
	return rc;
}