media: i2c: ov01a10: Move setting of ctrl->flags to after checking ctrl_hdlr->error

Instead of checking successful creation of the link_freq and vblank
controls, set their flags after checking ctrl_hdlr->error where it
is guaranteed that the controls will exist.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Tested-by: Mehdi Djait <mehdi.djait@linux.intel.com> # Dell XPS 9315
Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Hans de Goede 2025-10-14 19:40:22 +02:00 committed by Hans Verkuil
parent 82d1ab15cb
commit 7f0912eaca

View File

@ -460,8 +460,6 @@ static int ov01a10_init_controls(struct ov01a10 *ov01a10)
V4L2_CID_LINK_FREQ,
ov01a10->link_freq_index, 0,
link_freq_menu_items);
if (ov01a10->link_freq)
ov01a10->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ov01a10->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov01a10_ctrl_ops,
V4L2_CID_PIXEL_RATE, 0,
@ -478,8 +476,6 @@ static int ov01a10_init_controls(struct ov01a10 *ov01a10)
ov01a10->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov01a10_ctrl_ops,
V4L2_CID_HBLANK, h_blank, h_blank,
1, h_blank);
if (ov01a10->hblank)
ov01a10->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
v4l2_ctrl_new_std(ctrl_hdlr, &ov01a10_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
OV01A10_ANAL_GAIN_MIN, OV01A10_ANAL_GAIN_MAX,
@ -516,6 +512,9 @@ static int ov01a10_init_controls(struct ov01a10 *ov01a10)
goto fail;
}
ov01a10->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ov01a10->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ov01a10->sd.ctrl_handler = ctrl_hdlr;
return 0;