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

Configure Feed

Select the types of activity you want to include in your feed.

media: v4l2-ctrls: Set error v4l2_ctrl_new_fwnode_properties consistently

The vast majority of the callers of v4l2_ctrl_new_fwnode_properties() do
check the returned error code but the function does not set the control
handler's error on failure. This will make error handling more complicated
and prone for bugs.

Always assign the control handler's error field on error in
v4l2_ctrl_new_fwnode_properties().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Sakari Ailus and committed by
Hans Verkuil
e3d5436c 2759816f

+5 -1
+2 -1
drivers/media/v4l2-core/v4l2-ctrls-core.c
··· 2780 2780 orientation_ctrl = V4L2_CAMERA_ORIENTATION_EXTERNAL; 2781 2781 break; 2782 2782 default: 2783 - return -EINVAL; 2783 + hdl->error = -EINVAL; 2784 + return hdl->error; 2784 2785 } 2785 2786 if (!v4l2_ctrl_new_std_menu(hdl, ctrl_ops, 2786 2787 V4L2_CID_CAMERA_ORIENTATION,
+3
include/media/v4l2-ctrls.h
··· 1581 1581 * not overwritten. Callers should register the controls they want to handle 1582 1582 * themselves before calling this function. 1583 1583 * 1584 + * This function will set the control handler's error field on failure, just as 1585 + * other functions adding controls to the handler. 1586 + * 1584 1587 * Return: 0 on success, a negative error code on failure. 1585 1588 */ 1586 1589 int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,