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

Commit 4ff73984 authored by Peter Liu's avatar Peter Liu
Browse files

msm: camera: isp: potential undeliever count issue



Add defensive check for undeliver count
to avoid undefined behavior.
Also, if any failure lead to request frame fail,
undeliever count need to be set back properly.

Change-Id: I931517b8a7a307c4356f1ef044deb57e637ed554
Signed-off-by: default avatarPeter Liu <pingchie@codeaurora.org>
parent 66f4f85a
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -1247,6 +1247,8 @@ static int msm_isp_cfg_ping_pong_address(struct vfe_device *vfe_dev,
			vfe_dev->error_info.
				stream_framedrop_count[stream_idx]++;
			vfe_dev->error_info.framedrop_flag = 1;
			pr_err_ratelimited("%s: get buf fail! , rc = %d\n",
				__func__, rc);
			return rc;
		}

@@ -2281,7 +2283,8 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
			VFE_PING_FLAG, 1);
		if (rc) {
			spin_unlock_irqrestore(&stream_info->lock, flags);
			pr_err("%s:%d fail to set ping pong address\n",
			stream_info->undelivered_request_cnt--;
			pr_err_ratelimited("%s:%d fail to cfg HAL buffer\n",
				__func__, __LINE__);
			return rc;
		}
@@ -2299,10 +2302,17 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
			pingpong_status, 1);
		if (rc) {
			spin_unlock_irqrestore(&stream_info->lock, flags);
			pr_err("%s:%d fail to set ping pong address\n",
			stream_info->undelivered_request_cnt--;
			pr_err_ratelimited("%s:%d Failed to cfg HAL buffer\n",
				__func__, __LINE__);
			return rc;
		}
	} else {
		spin_unlock_irqrestore(&stream_info->lock, flags);
		stream_info->undelivered_request_cnt--;
		pr_err_ratelimited("%s: Invalid undeliver frame count %d\n",
			__func__, stream_info->undelivered_request_cnt);
		return -EINVAL;
	}

	msm_isp_calculate_framedrop(&vfe_dev->axi_data, &stream_cfg_cmd);