{
int ret;
- mutex_lock(&state->mutex);
+ lockdep_assert_held(&state->mutex);
adv7180_set_power_pin(state, true);
adv7180_set_reset_pin(state, false);
ret = state->chip_info->init(state);
if (ret)
- goto out_unlock;
+ return ret;
ret = adv7180_program_std(state);
if (ret)
- goto out_unlock;
+ return ret;
adv7180_set_field_mode(state);
ADV7180_ICONF1_ACTIVE_LOW |
ADV7180_ICONF1_PSYNC_ONLY);
if (ret < 0)
- goto out_unlock;
+ return ret;
ret = adv7180_write(state, ADV7180_REG_IMR1, 0);
if (ret < 0)
- goto out_unlock;
+ return ret;
ret = adv7180_write(state, ADV7180_REG_IMR2, 0);
if (ret < 0)
- goto out_unlock;
+ return ret;
/* enable AD change interrupts */
ret = adv7180_write(state, ADV7180_REG_IMR3,
ADV7180_IRQ3_AD_CHANGE);
if (ret < 0)
- goto out_unlock;
+ return ret;
ret = adv7180_write(state, ADV7180_REG_IMR4, 0);
if (ret < 0)
- goto out_unlock;
+ return ret;
}
-out_unlock:
- mutex_unlock(&state->mutex);
-
- return ret;
+ return 0;
}
static int adv7180_s_stream(struct v4l2_subdev *sd, int enable)
if (ret)
goto err_free_ctrl;
+ mutex_lock(&state->mutex);
ret = init_device(state);
+ mutex_unlock(&state->mutex);
if (ret)
goto err_media_entity_cleanup;
struct adv7180_state *state = to_state(sd);
int ret;
+ guard(mutex)(&state->mutex);
+
ret = init_device(state);
if (ret < 0)
return ret;