Bail out when the SRU control handler fails to initialize.

Signed-off-by: Laurent Pinchart <laurent.pinchart+rene...@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_sru.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_sru.c 
b/drivers/media/platform/vsp1/vsp1_sru.c
index aa0e04c..79efcaf 100644
--- a/drivers/media/platform/vsp1/vsp1_sru.c
+++ b/drivers/media/platform/vsp1/vsp1_sru.c
@@ -348,6 +348,14 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1)
        /* Initialize the control handler. */
        v4l2_ctrl_handler_init(&sru->ctrls, 1);
        v4l2_ctrl_new_custom(&sru->ctrls, &sru_intensity_control, NULL);
+
+       if (sru->ctrls.error) {
+               dev_err(vsp1->dev, "sru: failed to initialize controls\n");
+               ret = sru->ctrls.error;
+               v4l2_ctrl_handler_free(&sru->ctrls);
+               return ERR_PTR(ret);
+       }
+
        v4l2_ctrl_handler_setup(&sru->ctrls);
        sru->entity.subdev.ctrl_handler = &sru->ctrls;
 
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to