Message ID | 1401144409-13217-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, May 27, 2014 at 12:46:49AM +0200, Laurent Pinchart wrote: > Bail out when the SRU control handler fails to initialize. > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@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; > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
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;
Bail out when the SRU control handler fails to initialize. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/media/platform/vsp1/vsp1_sru.c | 8 ++++++++ 1 file changed, 8 insertions(+)