Skip to content

Commit fd10fb4

Browse files
AKoskovichgregkh
authored andcommitted
media: i2c: ov8856: free control handler on error in ov8856_init_controls()
commit f75e160 upstream. The control handler wasn't freed if adding controls failed, add an error exit label and convert the existing error return to use it. Fixes: 879347f ("media: ov8856: Add support for OV8856 sensor") Cc: stable@vger.kernel.org Signed-off-by: Alexander Koskovich <akoskovich@pm.me> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6467d65 commit fd10fb4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/media/i2c/ov8856.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,12 +1954,18 @@ static int ov8856_init_controls(struct ov8856 *ov8856)
19541954
V4L2_CID_HFLIP, 0, 1, 1, 0);
19551955
v4l2_ctrl_new_std(ctrl_hdlr, &ov8856_ctrl_ops,
19561956
V4L2_CID_VFLIP, 0, 1, 1, 0);
1957-
if (ctrl_hdlr->error)
1958-
return ctrl_hdlr->error;
1957+
if (ctrl_hdlr->error) {
1958+
ret = ctrl_hdlr->error;
1959+
goto err_ctrl_handler_free;
1960+
}
19591961

19601962
ov8856->sd.ctrl_handler = ctrl_hdlr;
19611963

19621964
return 0;
1965+
1966+
err_ctrl_handler_free:
1967+
v4l2_ctrl_handler_free(ctrl_hdlr);
1968+
return ret;
19631969
}
19641970

19651971
static void ov8856_update_pad_format(struct ov8856 *ov8856,

0 commit comments

Comments
 (0)