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

Commit 7073bf20 authored by Seemanta Dutta's avatar Seemanta Dutta
Browse files

msm: camera: Return correct code when camera open fails



There can be situations when opening camera will fail, not
due to an error but due to the fact that the current hardware
configuration can only support either the front or back camera
and can't support opening another the camera at the moment.

In such cases, rather than returning -EFAULT to user space, camera
should return -EBUSY so as to distinguish between a genuine failure
to open the camera and a failure due to current configuration which
precludes from opening another instance of the camera.

So, correct the return code in the camera open failure handling code.

Change-Id: Ib99ed919be44b40a1b0270a3d2a8a1794a0373cb
Signed-off-by: default avatarSeemanta Dutta <seemanta@codeaurora.org>
parent 84bfeac2
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -69,8 +69,17 @@ static int camera_check_event_status(struct v4l2_event *event)
				__func__);
		pr_err("%s : Line %d event_data->status 0X%x\n",
				__func__, __LINE__, event_data->status);

		switch (event_data->status) {
		case MSM_CAMERA_ERR_CMD_FAIL:
		case MSM_CAMERA_ERR_MAPPING:
			return -EFAULT;
		case MSM_CAMERA_ERR_DEVICE_BUSY:
			return -EBUSY;
		default:
			return -EFAULT;
		}
	}

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@
#define MSM_CAMERA_ERR_EVT_BASE 0x00010000
#define MSM_CAMERA_ERR_CMD_FAIL (MSM_CAMERA_ERR_EVT_BASE + 1)
#define MSM_CAMERA_ERR_MAPPING  (MSM_CAMERA_ERR_EVT_BASE + 2)
#define MSM_CAMERA_ERR_DEVICE_BUSY  (MSM_CAMERA_ERR_EVT_BASE + 3)

/* The msm_v4l2_event_data structure should match the
 * v4l2_event.u.data field.