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

Commit efae5a21 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Fix issues raised by static analyzer"

parents b929ba96 dca32865
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -739,6 +739,12 @@ static void hfi_process_sess_get_prop_buf_req(
	hfi_buf_req = (struct hfi_buffer_requirements *)
		&prop->rg_property_data[1];

	if (!hfi_buf_req) {
		dprintk(VIDC_ERR, "%s - invalid buffer req pointer\n",
			__func__);
		return;
	}

	while (req_bytes) {
		if ((hfi_buf_req->buffer_size) &&
			((hfi_buf_req->buffer_count_min > hfi_buf_req->
@@ -882,6 +888,11 @@ static void hfi_process_session_init_done(
	struct msm_vidc_cb_cmd_done cmd_done = {0};
	struct vidc_hal_session_init_done session_init_done;

	if (!session) {
		dprintk(VIDC_ERR, "%s - invalid session\n", __func__);
		return;
	}

	memset(&session_init_done, 0, sizeof(struct
				vidc_hal_session_init_done));
	dprintk(VIDC_DBG, "RECEIVED: SESSION_INIT_DONE[%p]\n", session);
@@ -900,7 +911,7 @@ static void hfi_process_session_init_done(
	if (!cmd_done.status) {
		cmd_done.status = hfi_process_sess_init_done_prop_read(
			pkt, &session_init_done);
	} else if (session) {
	} else {
		dprintk(VIDC_WARN,
			"Sess init failed: 0x%p, 0x%p\n",
			session->session_id, session);
+6 −1
Original line number Diff line number Diff line
@@ -892,7 +892,7 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
	unsigned int *plane_sizes = NULL;
	struct hfi_device *hdev;
	int stride, scanlines;
	int extra_idx = 0;
	unsigned int extra_idx = 0;
	int rc = 0;
	int i;
	struct hal_buffer_requirements *buff_req_buffer;
@@ -2308,6 +2308,11 @@ int msm_vdec_ctrl_init(struct msm_vidc_inst *inst)
			}
		}

		if (!ctrl) {
			dprintk(VIDC_ERR, "%s - invalid ctrl\n", __func__);
			return -EINVAL;
		}

		switch (msm_vdec_ctrls[idx].id) {
		case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
		case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
+15 −1
Original line number Diff line number Diff line
@@ -1117,6 +1117,13 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
					extra_idx < VIDEO_MAX_PLANES) {
				buff_req_buffer = get_buff_req_buffer(inst,
						HAL_BUFFER_EXTRADATA_OUTPUT);
				if (!buff_req_buffer) {
					dprintk(VIDC_ERR,
						"%s: failed - invalid buffer req\n",
						__func__);
					return -EINVAL;
				}

				sizes[i] = buff_req_buffer->buffer_size;
			}
		}
@@ -1163,6 +1170,13 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
		if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) {
			buff_req_buffer = get_buff_req_buffer(inst,
				HAL_BUFFER_EXTRADATA_INPUT);
			if (!buff_req_buffer) {
				dprintk(VIDC_ERR,
					"%s: failed - invalid buffer req\n",
					__func__);
				return -EINVAL;
			}

			sizes[extra_idx] = buff_req_buffer->buffer_size;
		}

@@ -2999,7 +3013,7 @@ int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
	int rc = 0;
	int i;
	u32 height, width;
	int extra_idx = 0;
	unsigned int extra_idx = 0;
	struct hal_buffer_requirements *buff_req_buffer = NULL;

	if (!inst || !f) {
+6 −2
Original line number Diff line number Diff line
@@ -1008,9 +1008,13 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
	}

	if (is_dynamic_output_buffer_mode(b, inst)) {
		if (!buffer_info)
			return -EINVAL;

		mutex_lock(&inst->lock);
		buffer_info->dequeued = true;
		mutex_unlock(&inst->lock);

		dprintk(VIDC_DBG, "[DEQUEUED]: fd[0] = %d\n",
			buffer_info->fd[0]);
		rc = unmap_and_deregister_buf(inst, buffer_info);
@@ -1124,8 +1128,8 @@ void *msm_vidc_smem_get_client(void *instance)
	struct msm_vidc_inst *inst = instance;

	if (!inst || !inst->mem_client) {
		dprintk(VIDC_ERR, "%s: invalid instance or client = %p %p\n",
				__func__, inst, inst->mem_client);
		dprintk(VIDC_ERR, "%s: invalid instance or client = %p\n",
				__func__, inst);
		return NULL;
	}

+12 −2
Original line number Diff line number Diff line
@@ -37,7 +37,10 @@
#define V4L2_EVENT_RELEASE_BUFFER_REFERENCE \
		V4L2_EVENT_MSM_VIDC_RELEASE_BUFFER_REFERENCE

#define IS_SESSION_CMD_VALID(cmd) ((cmd - SESSION_MSG_START) <= SESSION_MSG_END)
#define IS_SESSION_CMD_VALID(cmd) (((cmd) >= SESSION_MSG_START) && \
		(((cmd) - SESSION_MSG_START) <= SESSION_MSG_END))
#define IS_SYS_CMD_VALID(cmd) (((cmd) >= SYS_MSG_START) && \
		(((cmd) - SYS_MSG_START) <= SYS_MSG_END))

struct getprop_buf {
	struct list_head list;
@@ -382,7 +385,14 @@ static void handle_sys_init_done(enum command_response cmd, void *data)
	struct msm_vidc_cb_cmd_done *response = data;
	struct msm_vidc_core *core;
	struct vidc_hal_sys_init_done *sys_init_msg;
	int index = SYS_MSG_INDEX(cmd);
	unsigned int index;

	if (!IS_SYS_CMD_VALID(cmd)) {
		dprintk(VIDC_ERR, "%s - invalid cmd\n", __func__);
		return;
	}
	index = SYS_MSG_INDEX(cmd);

	if (!response) {
		dprintk(VIDC_ERR,
			"Failed to get valid response for sys init\n");
Loading