Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l: vsp1: sru: Fix the intensity control default value

The default value isn't set and defaults to 0, which isn't in the 1-6
min-max range. Fix it by setting the default value to 1.

This shoud have been caught when checking the control handler error
field at initialization time, but the check was missing. Add it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
a1606102 960de2cf

+11 -1
+11 -1
drivers/media/platform/vsp1/vsp1_sru.c
··· 67 67 .type = V4L2_CTRL_TYPE_INTEGER, 68 68 .min = 1, 69 69 .max = 6, 70 + .def = 1, 70 71 .step = 1, 71 72 }; 72 73 ··· 349 348 /* Initialize the control handler. */ 350 349 v4l2_ctrl_handler_init(&sru->ctrls, 1); 351 350 v4l2_ctrl_new_custom(&sru->ctrls, &sru_intensity_control, NULL); 352 - v4l2_ctrl_handler_setup(&sru->ctrls); 351 + 353 352 sru->entity.subdev.ctrl_handler = &sru->ctrls; 353 + 354 + if (sru->ctrls.error) { 355 + dev_err(vsp1->dev, "sru: failed to initialize controls\n"); 356 + ret = sru->ctrls.error; 357 + vsp1_entity_destroy(&sru->entity); 358 + return ERR_PTR(ret); 359 + } 360 + 361 + v4l2_ctrl_handler_setup(&sru->ctrls); 354 362 355 363 return sru; 356 364 }