[media] adv7604: set is_private only after successfully creating all controls

is_private was set right after creating each control, but the control pointer
might be NULL in case of an error. Set it after all controls were successfully
created, since that guarantees that all control pointers are non-NULL.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
Hans Verkuil 2013-08-22 06:11:17 -03:00 коммит произвёл Mauro Carvalho Chehab
Родитель b8f0fff427
Коммит 8c0eadb88b
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -2021,29 +2021,30 @@ static int adv7604_probe(struct i2c_client *client,
/* private controls */ /* private controls */
state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL, state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL,
V4L2_CID_DV_RX_POWER_PRESENT, 0, 1, 0, 0); V4L2_CID_DV_RX_POWER_PRESENT, 0, 1, 0, 0);
state->detect_tx_5v_ctrl->is_private = true;
state->rgb_quantization_range_ctrl = state->rgb_quantization_range_ctrl =
v4l2_ctrl_new_std_menu(hdl, &adv7604_ctrl_ops, v4l2_ctrl_new_std_menu(hdl, &adv7604_ctrl_ops,
V4L2_CID_DV_RX_RGB_RANGE, V4L2_DV_RGB_RANGE_FULL, V4L2_CID_DV_RX_RGB_RANGE, V4L2_DV_RGB_RANGE_FULL,
0, V4L2_DV_RGB_RANGE_AUTO); 0, V4L2_DV_RGB_RANGE_AUTO);
state->rgb_quantization_range_ctrl->is_private = true;
/* custom controls */ /* custom controls */
state->analog_sampling_phase_ctrl = state->analog_sampling_phase_ctrl =
v4l2_ctrl_new_custom(hdl, &adv7604_ctrl_analog_sampling_phase, NULL); v4l2_ctrl_new_custom(hdl, &adv7604_ctrl_analog_sampling_phase, NULL);
state->analog_sampling_phase_ctrl->is_private = true;
state->free_run_color_manual_ctrl = state->free_run_color_manual_ctrl =
v4l2_ctrl_new_custom(hdl, &adv7604_ctrl_free_run_color_manual, NULL); v4l2_ctrl_new_custom(hdl, &adv7604_ctrl_free_run_color_manual, NULL);
state->free_run_color_manual_ctrl->is_private = true;
state->free_run_color_ctrl = state->free_run_color_ctrl =
v4l2_ctrl_new_custom(hdl, &adv7604_ctrl_free_run_color, NULL); v4l2_ctrl_new_custom(hdl, &adv7604_ctrl_free_run_color, NULL);
state->free_run_color_ctrl->is_private = true;
sd->ctrl_handler = hdl; sd->ctrl_handler = hdl;
if (hdl->error) { if (hdl->error) {
err = hdl->error; err = hdl->error;
goto err_hdl; goto err_hdl;
} }
state->detect_tx_5v_ctrl->is_private = true;
state->rgb_quantization_range_ctrl->is_private = true;
state->analog_sampling_phase_ctrl->is_private = true;
state->free_run_color_manual_ctrl->is_private = true;
state->free_run_color_ctrl->is_private = true;
if (adv7604_s_detect_tx_5v_ctrl(sd)) { if (adv7604_s_detect_tx_5v_ctrl(sd)) {
err = -ENODEV; err = -ENODEV;
goto err_hdl; goto err_hdl;