From ca0c16ad01270ea43e2721d0f917957575ddccf2 Mon Sep 17 00:00:00 2001 From: Pengfei Liu Date: Thu, 29 Jun 2017 11:40:24 +0800 Subject: [PATCH] msm: actuator: Add protection condition for move focus Neighbour index of step table possibly have same position, so i2c operation reported invalid size parameters. we add protection condition to return success value. Change-Id: I7dab8f44a99c7c3c7d6996c8decb8bcd09c246c9 Signed-off-by: penliu --- .../platform/msm/camera_v2/sensor/actuator/msm_actuator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c index cd48f871eb79..bc844bb87db5 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c +++ b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c @@ -573,7 +573,10 @@ static int32_t msm_actuator_move_focus( CDBG("called, dir %d, num_steps %d\n", dir, num_steps); - if (dest_step_pos == a_ctrl->curr_step_pos) + if ((dest_step_pos == a_ctrl->curr_step_pos) || + ((dest_step_pos <= a_ctrl->total_steps) && + (a_ctrl->step_position_table[dest_step_pos] == + a_ctrl->step_position_table[a_ctrl->curr_step_pos]))) return rc; if ((sign_dir > MSM_ACTUATOR_MOVE_SIGNED_NEAR) ||