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

Commit 9f692005 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: cvp: Allocating karg dynamically"

parents e7f9f97f f806d62b
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -826,6 +826,9 @@ static int __read_queue(struct cvp_iface_q_info *qinfo, u8 *packet,
		 */
		mb();
		*pb_tx_req_is_set = 0;
		if (write_idx != queue->qhdr_write_idx) {
			queue->qhdr_rx_req = 0;
		} else {
			spin_unlock(&qinfo->hfi_lock);
			dprintk(CVP_DBG,
				"%s queue is empty, rx_req = %u, tx_req = %u, read_idx = %u\n",
@@ -834,6 +837,7 @@ static int __read_queue(struct cvp_iface_q_info *qinfo, u8 *packet,
				queue->qhdr_read_idx);
			return -ENODATA;
		}
	}

	read_ptr = (u32 *)((qinfo->q_array.align_virtual_addr) +
				(read_idx << 2));
@@ -876,7 +880,7 @@ static int __read_queue(struct cvp_iface_q_info *qinfo, u8 *packet,
		rc = -ENODATA;
	}

	if (read_idx != write_idx)
	if (new_read_idx != queue->qhdr_write_idx)
		queue->qhdr_rx_req = 0;
	else
		queue->qhdr_rx_req = receive_request;
+15 −9
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 */

#include "msm_v4l2_private.h"
@@ -612,34 +612,40 @@ static long cvp_ioctl(struct msm_cvp_inst *inst,
	unsigned int cmd, unsigned long arg)
{
	int rc;
	struct cvp_kmd_arg karg;
	struct cvp_kmd_arg *karg;

	if (!inst) {
		dprintk(CVP_ERR, "%s: invalid params\n", __func__);
		return -EINVAL;
	}

	memset(&karg, 0, sizeof(struct cvp_kmd_arg));
	karg = kzalloc(sizeof(*karg), GFP_KERNEL);
	if (!karg)
		return -ENOMEM;

	if (convert_from_user(&karg, arg, inst)) {
	if (convert_from_user(karg, arg, inst)) {
		dprintk(CVP_ERR, "%s: failed to get from user cmd %x\n",
			__func__, karg.type);
			__func__, karg->type);
		kfree(karg);
		return -EFAULT;
	}

	rc = msm_cvp_private((void *)inst, cmd, &karg);
	rc = msm_cvp_private((void *)inst, cmd, karg);
	if (rc) {
		dprintk(CVP_ERR, "%s: failed cmd type %x %d\n",
			__func__, karg.type, rc);
			__func__, karg->type, rc);
		kfree(karg);
		return rc;
	}

	if (convert_to_user(&karg, arg)) {
	if (convert_to_user(karg, arg)) {
		dprintk(CVP_ERR, "%s: failed to copy to user cmd %x\n",
			__func__, karg.type);
			__func__, karg->type);
		kfree(karg);
		return -EFAULT;
	}

	kfree(karg);
	return rc;
}